diff --git a/CLI.md b/CLI.md
index 27bf625b..f450aa79 100644
--- a/CLI.md
+++ b/CLI.md
@@ -745,6 +745,498 @@ Delete a watchlist:
secops watchlist delete --watchlist-id "abc-123-def"
```
+### Integration Management
+
+#### Integration Transformers
+
+List integration transformers:
+
+```bash
+# List all transformers for an integration
+secops integration transformers list --integration-name "MyIntegration"
+
+# List transformers as a direct list (fetches all pages automatically)
+secops integration transformers list --integration-name "MyIntegration" --as-list
+
+# List with pagination
+secops integration transformers list --integration-name "MyIntegration" --page-size 50
+
+# List with filtering
+secops integration transformers list --integration-name "MyIntegration" --filter-string "enabled = true"
+
+# Exclude staging transformers
+secops integration transformers list --integration-name "MyIntegration" --exclude-staging
+
+# List with expanded details
+secops integration transformers list --integration-name "MyIntegration" --expand "parameters"
+```
+
+Get transformer details:
+
+```bash
+# Get basic transformer details
+secops integration transformers get \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1"
+
+# Get transformer with expanded parameters
+secops integration transformers get \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --expand "parameters"
+```
+
+Create a new transformer:
+
+```bash
+# Create a basic transformer
+secops integration transformers create \
+ --integration-name "MyIntegration" \
+ --display-name "JSON Parser" \
+ --script "def transform(data): import json; return json.loads(data)" \
+ --script-timeout "60s" \
+ --enabled
+
+# Create transformer with description
+secops integration transformers create \
+ --integration-name "MyIntegration" \
+ --display-name "Data Enricher" \
+ --script "def transform(data): return {'enriched': data, 'timestamp': '2024-01-01'}" \
+ --script-timeout "120s" \
+ --description "Enriches data with additional fields" \
+ --enabled
+```
+
+> **Note:** When creating a transformer:
+> - `--script-timeout` should be specified with a unit (e.g., "60s", "2m")
+> - Use `--enabled` flag to enable the transformer on creation (default is disabled)
+> - The script must be valid Python code with a `transform()` function
+
+Update an existing transformer:
+
+```bash
+# Update display name
+secops integration transformers update \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --display-name "Updated Transformer Name"
+
+# Update script
+secops integration transformers update \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --script "def transform(data): return data.upper()"
+
+# Update multiple fields
+secops integration transformers update \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --display-name "Enhanced Transformer" \
+ --description "Updated with better error handling" \
+ --script-timeout "90s" \
+ --enabled true
+
+# Update with custom update mask
+secops integration transformers update \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --display-name "New Name" \
+ --description "New description" \
+ --update-mask "displayName,description"
+```
+
+Delete a transformer:
+
+```bash
+secops integration transformers delete \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1"
+```
+
+Test a transformer:
+
+```bash
+# Test an existing transformer to verify it works correctly
+secops integration transformers test \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1"
+```
+
+Get transformer template:
+
+```bash
+# Get a boilerplate template for creating a new transformer
+secops integration transformers template --integration-name "MyIntegration"
+```
+
+#### Transformer Revisions
+
+List transformer revisions:
+
+```bash
+# List all revisions for a transformer
+secops integration transformer-revisions list \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1"
+
+# List revisions as a direct list
+secops integration transformer-revisions list \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --as-list
+
+# List with pagination
+secops integration transformer-revisions list \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --page-size 10
+
+# List with filtering and ordering
+secops integration transformer-revisions list \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --filter-string "version = '1.0'" \
+ --order-by "createTime desc"
+```
+
+Delete a transformer revision:
+
+```bash
+# Delete a specific revision
+secops integration transformer-revisions delete \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --revision-id "rev-456"
+```
+
+Create a new revision:
+
+```bash
+# Create a backup revision before making changes
+secops integration transformer-revisions create \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --comment "Backup before major refactor"
+
+# Create a revision with descriptive comment
+secops integration transformer-revisions create \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --comment "Version 2.0 - Enhanced error handling"
+```
+
+Rollback to a previous revision:
+
+```bash
+# Rollback transformer to a specific revision
+secops integration transformer-revisions rollback \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --revision-id "rev-456"
+```
+
+Example workflow: Safe transformer updates with revision control:
+
+```bash
+# 1. Create a backup revision
+secops integration transformer-revisions create \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --comment "Backup before updating transformation logic"
+
+# 2. Update the transformer
+secops integration transformers update \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --script "def transform(data): return data.upper()" \
+ --description "Updated with new transformation"
+
+# 3. Test the updated transformer
+secops integration transformers test \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1"
+
+# 4. If test fails, rollback to the backup revision
+# First, list revisions to get the backup revision ID
+secops integration transformer-revisions list \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --order-by "createTime desc" \
+ --page-size 1
+
+# Then rollback using the revision ID
+secops integration transformer-revisions rollback \
+ --integration-name "MyIntegration" \
+ --transformer-id "t1" \
+ --revision-id "rev-backup-id"
+```
+
+#### Logical Operators
+
+List logical operators:
+
+```bash
+# List all logical operators for an integration
+secops integration logical-operators list --integration-name "MyIntegration"
+
+# List logical operators as a direct list
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --as-list
+
+# List with pagination
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --page-size 50
+
+# List with filtering
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --filter-string "enabled = true"
+
+# Exclude staging logical operators
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --exclude-staging
+
+# List with expanded details
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --expand "parameters"
+```
+
+Get logical operator details:
+
+```bash
+# Get basic logical operator details
+secops integration logical-operators get \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+
+# Get logical operator with expanded parameters
+secops integration logical-operators get \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --expand "parameters"
+```
+
+Create a new logical operator:
+
+```bash
+# Create a basic equality operator
+secops integration logical-operators create \
+ --integration-name "MyIntegration" \
+ --display-name "Equals Operator" \
+ --script "def evaluate(a, b): return a == b" \
+ --script-timeout "60s" \
+ --enabled
+
+# Create logical operator with description
+secops integration logical-operators create \
+ --integration-name "MyIntegration" \
+ --display-name "Threshold Checker" \
+ --script "def evaluate(value, threshold): return value > threshold" \
+ --script-timeout "30s" \
+ --description "Checks if value exceeds threshold" \
+ --enabled
+```
+
+> **Note:** When creating a logical operator:
+> - `--script-timeout` should be specified with a unit (e.g., "60s", "2m")
+> - Use `--enabled` flag to enable the operator on creation (default is disabled)
+> - The script must be valid Python code with an `evaluate()` function
+
+Update an existing logical operator:
+
+```bash
+# Update display name
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --display-name "Updated Operator Name"
+
+# Update script
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --script "def evaluate(a, b): return a != b"
+
+# Update multiple fields
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --display-name "Enhanced Operator" \
+ --description "Updated with better logic" \
+ --script-timeout "45s" \
+ --enabled true
+
+# Update with custom update mask
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --display-name "New Name" \
+ --description "New description" \
+ --update-mask "displayName,description"
+```
+
+Delete a logical operator:
+
+```bash
+secops integration logical-operators delete \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+```
+
+Test a logical operator:
+
+```bash
+# Test an existing logical operator to verify it works correctly
+secops integration logical-operators test \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+```
+
+Get logical operator template:
+
+```bash
+# Get a boilerplate template for creating a new logical operator
+secops integration logical-operators template --integration-name "MyIntegration"
+```
+
+Example workflow: Building conditional logic:
+
+```bash
+# 1. Get a template to start with
+secops integration logical-operators template \
+ --integration-name "MyIntegration"
+
+# 2. Create a severity checker operator
+secops integration logical-operators create \
+ --integration-name "MyIntegration" \
+ --display-name "Severity Level Check" \
+ --script "def evaluate(severity, min_level): return severity >= min_level" \
+ --script-timeout "30s" \
+ --description "Checks if severity meets minimum threshold"
+
+# 3. Test the operator
+secops integration logical-operators test \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+
+# 4. Enable the operator if test passes
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --enabled true
+
+# 5. List all operators to see what's available
+secops integration logical-operators list \
+ --integration-name "MyIntegration" \
+ --as-list
+```
+
+#### Logical Operator Revisions
+
+List logical operator revisions:
+
+```bash
+# List all revisions for a logical operator
+secops integration logical-operator-revisions list \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+
+# List revisions as a direct list
+secops integration logical-operator-revisions list \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --as-list
+
+# List with pagination
+secops integration logical-operator-revisions list \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --page-size 10
+
+# List with filtering and ordering
+secops integration logical-operator-revisions list \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --filter-string "version = '1.0'" \
+ --order-by "createTime desc"
+```
+
+Delete a logical operator revision:
+
+```bash
+# Delete a specific revision
+secops integration logical-operator-revisions delete \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --revision-id "rev-456"
+```
+
+Create a new revision:
+
+```bash
+# Create a backup revision before making changes
+secops integration logical-operator-revisions create \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --comment "Backup before refactoring evaluation logic"
+
+# Create a revision with descriptive comment
+secops integration logical-operator-revisions create \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --comment "Version 2.0 - Enhanced comparison logic"
+```
+
+Rollback to a previous revision:
+
+```bash
+# Rollback logical operator to a specific revision
+secops integration logical-operator-revisions rollback \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --revision-id "rev-456"
+```
+
+Example workflow: Safe logical operator updates with revision control:
+
+```bash
+# 1. Create a backup revision
+secops integration logical-operator-revisions create \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --comment "Backup before updating conditional logic"
+
+# 2. Update the logical operator
+secops integration logical-operators update \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --script "def evaluate(a, b): return a >= b" \
+ --description "Updated with greater-than-or-equal logic"
+
+# 3. Test the updated logical operator
+secops integration logical-operators test \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1"
+
+# 4. If test fails, rollback to the backup revision
+# First, list revisions to get the backup revision ID
+secops integration logical-operator-revisions list \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --order-by "createTime desc" \
+ --page-size 1
+
+# Then rollback using the revision ID
+secops integration logical-operator-revisions rollback \
+ --integration-name "MyIntegration" \
+ --logical-operator-id "lo1" \
+ --revision-id "rev-backup-id"
+```
+
### Rule Management
List detection rules:
@@ -896,7 +1388,6 @@ secops curated-rule search-detections \
--end-time "2024-01-31T23:59:59Z" \
--list-basis "DETECTION_TIME" \
--page-size 50
-
```
List all curated rule sets:
@@ -1543,39 +2034,7 @@ secops reference-list create \
secops parser list
# Get details of a specific parser
-secops parser get --log-type "WINDOWS" --id "pa_12345"
-
-# Create a custom parser for a new log format
-secops parser create \
- --log-type "CUSTOM_APPLICATION" \
- --parser-code-file "/path/to/custom_parser.conf" \
- --validated-on-empty-logs
-
-# Copy an existing parser as a starting point
-secops parser copy --log-type "OKTA" --id "pa_okta_base"
-
-# Activate your custom parser
-secops parser activate --log-type "CUSTOM_APPLICATION" --id "pa_new_custom"
-
-# If needed, deactivate and delete old parser
-secops parser deactivate --log-type "CUSTOM_APPLICATION" --id "pa_old_custom"
-secops parser delete --log-type "CUSTOM_APPLICATION" --id "pa_old_custom"
-```
-
-### Complete Parser Workflow Example: Retrieve, Run, and Ingest
-
-This example demonstrates the complete workflow of retrieving an OKTA parser, running it against a sample log, and ingesting the parsed UDM event:
-
-```bash
-# Step 1: List OKTA parsers to find an active one
-secops parser list --log-type "OKTA" > okta_parsers.json
-
-# Extract the first parser ID (you can use jq or grep)
-PARSER_ID=$(cat okta_parsers.json | jq -r '.[0].name' | awk -F'/' '{print $NF}')
-echo "Using parser: $PARSER_ID"
-
-# Step 2: Get the parser details and save to a file
-secops parser get --log-type "OKTA" --id "$PARSER_ID" > parser_details.json
+secops parser get --log-type "WINDOWS" --id "$PARSER_ID" > parser_details.json
# Extract and decode the parser code (base64 encoded in 'cbn' field)
cat parser_details.json | jq -r '.cbn' | base64 -d > okta_parser.conf
@@ -1713,7 +2172,7 @@ secops feed update --id "feed-123" --display-name "Updated Feed Name"
secops feed update --id "feed-123" --details '{"httpSettings":{"uri":"https://example.com/updated-feed","sourceType":"FILES"}}'
# Update both display name and details
-secops feed update --id "feed-123" --display-name "Updated Name" --details '{"httpSettings":{"uri":"https://example.com/updated-feed"}}'
+secops feed update --id "feed-123" --display-name "New Name" --details '{"httpSettings":{"uri":"https://example.com/updated-feed"}}'
```
Enable and disable feeds:
@@ -1854,4 +2313,5 @@ secops dashboard-query get --id query-id
## Conclusion
-The SecOps CLI provides a powerful way to interact with Google Security Operations products directly from your terminal. For more detailed information about the SDK capabilities, refer to the [main README](README.md).
\ No newline at end of file
+The SecOps CLI provides a powerful way to interact with Google Security Operations products directly from your terminal. For more detailed information about the SDK capabilities, refer to the [main README](README.md).
+
diff --git a/README.md b/README.md
index d746ad5a..3f70be55 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+from tests.chronicle.test_rule_integration import chronicle
+
# Google SecOps SDK for Python
[](https://pypi.org/project/secops/)
@@ -1907,6 +1909,1025 @@ for watchlist in watchlists:
print(f"Watchlist: {watchlist.get('displayName')}")
```
+## Integration Management
+
+### Integration Transformers
+
+List all transformers for a specific integration:
+
+```python
+# Get all transformers for an integration
+transformers = chronicle.list_integration_transformers("MyIntegration")
+for transformer in transformers.get("transformers", []):
+ print(f"Transformer: {transformer.get('displayName')}, ID: {transformer.get('name')}")
+
+# Get all transformers as a list
+transformers = chronicle.list_integration_transformers("MyIntegration", as_list=True)
+
+# Get only enabled transformers
+transformers = chronicle.list_integration_transformers(
+ "MyIntegration",
+ filter_string="enabled = true"
+)
+
+# Exclude staging transformers
+transformers = chronicle.list_integration_transformers(
+ "MyIntegration",
+ exclude_staging=True
+)
+
+# Get transformers with expanded details
+transformers = chronicle.list_integration_transformers(
+ "MyIntegration",
+ expand="parameters"
+)
+```
+
+Get details of a specific transformer:
+
+```python
+transformer = chronicle.get_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+print(f"Display Name: {transformer.get('displayName')}")
+print(f"Script: {transformer.get('script')}")
+print(f"Enabled: {transformer.get('enabled')}")
+
+# Get transformer with expanded parameters
+transformer = chronicle.get_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ expand="parameters"
+)
+```
+
+Create a new transformer:
+
+```python
+# Create a basic transformer
+new_transformer = chronicle.create_integration_transformer(
+ integration_name="MyIntegration",
+ display_name="JSON Parser",
+ script="""
+def transform(data):
+ import json
+ try:
+ return json.loads(data)
+ except Exception as e:
+ return {"error": str(e)}
+""",
+ script_timeout="60s",
+ enabled=True
+)
+
+# Create transformer with all fields
+new_transformer = chronicle.create_integration_transformer(
+ integration_name="MyIntegration",
+ display_name="Advanced Data Transformer",
+ description="Transforms and enriches incoming data",
+ script="""
+def transform(data, api_key, endpoint_url):
+ import json
+ import requests
+
+ # Parse input data
+ parsed = json.loads(data)
+
+ # Enrich with external API call
+ response = requests.get(
+ endpoint_url,
+ headers={"Authorization": f"Bearer {api_key}"}
+ )
+ parsed["enrichment"] = response.json()
+
+ return parsed
+""",
+ script_timeout="120s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "api_key",
+ "type": "STRING",
+ "displayName": "API Key",
+ "mandatory": True
+ },
+ {
+ "name": "endpoint_url",
+ "type": "STRING",
+ "displayName": "Endpoint URL",
+ "mandatory": True
+ }
+ ],
+ usage_example="Used to enrich security events with external threat intelligence",
+ expected_input='{"event": "data", "timestamp": "2024-01-01T00:00:00Z"}',
+ expected_output='{"event": "data", "timestamp": "2024-01-01T00:00:00Z", "enrichment": {...}}'
+)
+```
+
+Update an existing transformer:
+
+```python
+# Update transformer display name
+updated_transformer = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ display_name="Updated Transformer Name"
+)
+
+# Update transformer script
+updated_transformer = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ script="""
+def transform(data):
+ # Updated transformation logic
+ return data.upper()
+"""
+)
+
+# Update multiple fields including parameters
+updated_transformer = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ display_name="Enhanced Transformer",
+ description="Updated with better error handling",
+ script="""
+def transform(data, timeout=30):
+ import json
+ try:
+ result = json.loads(data)
+ result["processed"] = True
+ return result
+ except Exception as e:
+ return {"error": str(e), "original": data}
+""",
+ script_timeout="90s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "timeout",
+ "type": "INTEGER",
+ "displayName": "Processing Timeout",
+ "mandatory": False,
+ "defaultValue": "30"
+ }
+ ]
+)
+
+# Use custom update mask
+updated_transformer = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ display_name="New Name",
+ description="New Description",
+ update_mask="displayName,description"
+)
+```
+
+Delete a transformer:
+
+```python
+chronicle.delete_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+```
+
+Execute a test run of a transformer:
+
+```python
+# Get the transformer
+transformer = chronicle.get_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+
+# Test the transformer with sample data
+test_result = chronicle.execute_integration_transformer_test(
+ integration_name="MyIntegration",
+ transformer=transformer
+)
+print(f"Output Message: {test_result.get('outputMessage')}")
+print(f"Debug Output: {test_result.get('debugOutputMessage')}")
+print(f"Result Value: {test_result.get('resultValue')}")
+
+# You can also test a transformer before creating it
+test_transformer = {
+ "displayName": "Test Transformer",
+ "script": """
+def transform(data):
+ return {"transformed": data, "status": "success"}
+""",
+ "scriptTimeout": "60s",
+ "enabled": True
+}
+
+test_result = chronicle.execute_integration_transformer_test(
+ integration_name="MyIntegration",
+ transformer=test_transformer
+)
+```
+
+Get a template for creating a transformer:
+
+```python
+# Get a boilerplate template for a new transformer
+template = chronicle.get_integration_transformer_template("MyIntegration")
+print(f"Template Script: {template.get('script')}")
+print(f"Template Display Name: {template.get('displayName')}")
+
+# Use the template as a starting point
+new_transformer = chronicle.create_integration_transformer(
+ integration_name="MyIntegration",
+ display_name="My Custom Transformer",
+ script=template.get('script'), # Customize this
+ script_timeout="60s",
+ enabled=True
+)
+```
+
+Example workflow: Safe transformer development with testing:
+
+```python
+# 1. Get a template to start with
+template = chronicle.get_integration_transformer_template("MyIntegration")
+
+# 2. Customize the script
+custom_transformer = {
+ "displayName": "CSV to JSON Transformer",
+ "description": "Converts CSV data to JSON format",
+ "script": """
+def transform(data):
+ import csv
+ import json
+ from io import StringIO
+
+ # Parse CSV
+ reader = csv.DictReader(StringIO(data))
+ rows = list(reader)
+
+ return json.dumps(rows)
+""",
+ "scriptTimeout": "60s",
+ "enabled": False, # Start disabled for testing
+ "usageExample": "Input CSV with headers, output JSON array of objects"
+}
+
+# 3. Test the transformer before creating it
+test_result = chronicle.execute_integration_transformer_test(
+ integration_name="MyIntegration",
+ transformer=custom_transformer
+)
+
+# 4. If test is successful, create the transformer
+if test_result.get('resultValue'):
+ created_transformer = chronicle.create_integration_transformer(
+ integration_name="MyIntegration",
+ display_name=custom_transformer["displayName"],
+ description=custom_transformer["description"],
+ script=custom_transformer["script"],
+ script_timeout=custom_transformer["scriptTimeout"],
+ enabled=True, # Enable after successful testing
+ usage_example=custom_transformer["usageExample"]
+ )
+ print(f"Transformer created: {created_transformer.get('name')}")
+else:
+ print(f"Test failed: {test_result.get('debugOutputMessage')}")
+
+# 5. Continue testing and refining
+transformer_id = created_transformer.get('name').split('/')[-1]
+updated = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id=transformer_id,
+ script="""
+def transform(data, delimiter=','):
+ import csv
+ import json
+ from io import StringIO
+
+ # Parse CSV with custom delimiter
+ reader = csv.DictReader(StringIO(data), delimiter=delimiter)
+ rows = list(reader)
+
+ return json.dumps(rows, indent=2)
+""",
+ parameters=[
+ {
+ "name": "delimiter",
+ "type": "STRING",
+ "displayName": "CSV Delimiter",
+ "mandatory": False,
+ "defaultValue": ","
+ }
+ ]
+)
+```
+
+### Integration Transformer Revisions
+
+List all revisions for a transformer:
+
+```python
+# Get all revisions for a transformer
+revisions = chronicle.list_integration_transformer_revisions(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+for revision in revisions.get("revisions", []):
+ print(f"Revision: {revision.get('name')}, Comment: {revision.get('comment')}")
+
+# Get all revisions as a list
+revisions = chronicle.list_integration_transformer_revisions(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ as_list=True
+)
+
+# Filter revisions
+revisions = chronicle.list_integration_transformer_revisions(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ filter_string='version = "1.0"',
+ order_by="createTime desc"
+)
+```
+
+Delete a specific transformer revision:
+
+```python
+chronicle.delete_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ revision_id="rev-456"
+)
+```
+
+Create a new revision before making changes:
+
+```python
+# Get the current transformer
+transformer = chronicle.get_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+
+# Create a backup revision
+new_revision = chronicle.create_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ transformer=transformer,
+ comment="Backup before major refactor"
+)
+print(f"Created revision: {new_revision.get('name')}")
+
+# Create revision with custom comment
+new_revision = chronicle.create_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ transformer=transformer,
+ comment="Version 2.0 - Enhanced error handling"
+)
+```
+
+Rollback to a previous revision:
+
+```python
+# Rollback to a previous working version
+rollback_result = chronicle.rollback_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ revision_id="rev-456"
+)
+print(f"Rolled back to: {rollback_result.get('name')}")
+```
+
+Example workflow: Safe transformer updates with revision control:
+
+```python
+# 1. Get the current transformer
+transformer = chronicle.get_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1"
+)
+
+# 2. Create a backup revision
+backup = chronicle.create_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ transformer=transformer,
+ comment="Backup before updating transformation logic"
+)
+
+# 3. Make changes to the transformer
+updated_transformer = chronicle.update_integration_transformer(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ display_name="Enhanced Transformer",
+ script="""
+def transform(data, enrichment_enabled=True):
+ import json
+
+ try:
+ # Parse input data
+ parsed = json.loads(data)
+
+ # Apply transformations
+ parsed["processed"] = True
+ parsed["timestamp"] = "2024-01-01T00:00:00Z"
+
+ # Optional enrichment
+ if enrichment_enabled:
+ parsed["enriched"] = True
+
+ return json.dumps(parsed)
+ except Exception as e:
+ return json.dumps({"error": str(e), "original": data})
+"""
+)
+
+# 4. Test the updated transformer
+test_result = chronicle.execute_integration_transformer_test(
+ integration_name="MyIntegration",
+ transformer=updated_transformer
+)
+
+# 5. If test fails, rollback to backup
+if not test_result.get("resultValue"):
+ print("Test failed - rolling back")
+ chronicle.rollback_integration_transformer_revision(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ revision_id=backup.get("name").split("/")[-1]
+ )
+else:
+ print("Test passed - transformer updated successfully")
+
+# 6. List all revisions to see history
+all_revisions = chronicle.list_integration_transformer_revisions(
+ integration_name="MyIntegration",
+ transformer_id="t1",
+ as_list=True
+)
+print(f"Total revisions: {len(all_revisions)}")
+for rev in all_revisions:
+ print(f" - {rev.get('comment', 'No comment')} (ID: {rev.get('name').split('/')[-1]})")
+```
+
+### Integration Logical Operators
+
+List all logical operators for a specific integration:
+
+```python
+# Get all logical operators for an integration
+logical_operators = chronicle.list_integration_logical_operators("MyIntegration")
+for operator in logical_operators.get("logicalOperators", []):
+ print(f"Operator: {operator.get('displayName')}, ID: {operator.get('name')}")
+
+# Get all logical operators as a list
+logical_operators = chronicle.list_integration_logical_operators(
+ "MyIntegration",
+ as_list=True
+)
+
+# Get only enabled logical operators
+logical_operators = chronicle.list_integration_logical_operators(
+ "MyIntegration",
+ filter_string="enabled = true"
+)
+
+# Exclude staging logical operators
+logical_operators = chronicle.list_integration_logical_operators(
+ "MyIntegration",
+ exclude_staging=True
+)
+
+# Get logical operators with expanded details
+logical_operators = chronicle.list_integration_logical_operators(
+ "MyIntegration",
+ expand="parameters"
+)
+```
+
+Get details of a specific logical operator:
+
+```python
+operator = chronicle.get_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+print(f"Display Name: {operator.get('displayName')}")
+print(f"Script: {operator.get('script')}")
+print(f"Enabled: {operator.get('enabled')}")
+
+# Get logical operator with expanded parameters
+operator = chronicle.get_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ expand="parameters"
+)
+```
+
+Create a new logical operator:
+
+```python
+# Create a basic equality operator
+new_operator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="Equals Operator",
+ script="""
+def evaluate(a, b):
+ return a == b
+""",
+ script_timeout="60s",
+ enabled=True
+)
+
+# Create a more complex conditional operator with parameters
+new_operator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="Threshold Checker",
+ description="Checks if a value exceeds a threshold",
+ script="""
+def evaluate(value, threshold, inclusive=False):
+ if inclusive:
+ return value >= threshold
+ else:
+ return value > threshold
+""",
+ script_timeout="30s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "value",
+ "type": "INTEGER",
+ "displayName": "Value to Check",
+ "mandatory": True
+ },
+ {
+ "name": "threshold",
+ "type": "INTEGER",
+ "displayName": "Threshold Value",
+ "mandatory": True
+ },
+ {
+ "name": "inclusive",
+ "type": "BOOLEAN",
+ "displayName": "Inclusive Comparison",
+ "mandatory": False,
+ "defaultValue": "false"
+ }
+ ]
+)
+
+# Create a string matching operator
+pattern_operator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="Pattern Matcher",
+ description="Matches strings against patterns",
+ script="""
+def evaluate(text, pattern, case_sensitive=True):
+ import re
+ flags = 0 if case_sensitive else re.IGNORECASE
+ return bool(re.search(pattern, text, flags))
+""",
+ script_timeout="60s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "text",
+ "type": "STRING",
+ "displayName": "Text to Match",
+ "mandatory": True
+ },
+ {
+ "name": "pattern",
+ "type": "STRING",
+ "displayName": "Regex Pattern",
+ "mandatory": True
+ },
+ {
+ "name": "case_sensitive",
+ "type": "BOOLEAN",
+ "displayName": "Case Sensitive",
+ "mandatory": False,
+ "defaultValue": "true"
+ }
+ ]
+)
+```
+
+Update an existing logical operator:
+
+```python
+# Update logical operator display name
+updated_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ display_name="Updated Operator Name"
+)
+
+# Update logical operator script
+updated_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ script="""
+def evaluate(a, b):
+ # Updated logic with type checking
+ if type(a) != type(b):
+ return False
+ return a == b
+"""
+)
+
+# Update multiple fields including parameters
+updated_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ display_name="Enhanced Operator",
+ description="Updated with better validation",
+ script="""
+def evaluate(value, min_value, max_value):
+ try:
+ return min_value <= value <= max_value
+ except Exception:
+ return False
+""",
+ script_timeout="45s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "value",
+ "type": "INTEGER",
+ "displayName": "Value",
+ "mandatory": True
+ },
+ {
+ "name": "min_value",
+ "type": "INTEGER",
+ "displayName": "Minimum Value",
+ "mandatory": True
+ },
+ {
+ "name": "max_value",
+ "type": "INTEGER",
+ "displayName": "Maximum Value",
+ "mandatory": True
+ }
+ ]
+)
+
+# Use custom update mask
+updated_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ display_name="New Name",
+ description="New Description",
+ update_mask="displayName,description"
+)
+```
+
+Delete a logical operator:
+
+```python
+chronicle.delete_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+```
+
+Execute a test run of a logical operator:
+
+```python
+# Get the logical operator
+operator = chronicle.get_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+
+# Test the logical operator with sample data
+test_result = chronicle.execute_integration_logical_operator_test(
+ integration_name="MyIntegration",
+ logical_operator=operator
+)
+print(f"Output Message: {test_result.get('outputMessage')}")
+print(f"Debug Output: {test_result.get('debugOutputMessage')}")
+print(f"Result Value: {test_result.get('resultValue')}") # True or False
+
+# You can also test a logical operator before creating it
+test_operator = {
+ "displayName": "Test Equality Operator",
+ "script": """
+def evaluate(a, b):
+ return a == b
+""",
+ "scriptTimeout": "30s",
+ "enabled": True
+}
+
+test_result = chronicle.execute_integration_logical_operator_test(
+ integration_name="MyIntegration",
+ logical_operator=test_operator
+)
+```
+
+Get a template for creating a logical operator:
+
+```python
+# Get a boilerplate template for a new logical operator
+template = chronicle.get_integration_logical_operator_template("MyIntegration")
+print(f"Template Script: {template.get('script')}")
+print(f"Template Display Name: {template.get('displayName')}")
+
+# Use the template as a starting point
+new_operator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="My Custom Operator",
+ script=template.get('script'), # Customize this
+ script_timeout="60s",
+ enabled=True
+)
+```
+
+Example workflow: Building conditional logic for integration workflows:
+
+```python
+# 1. Get a template to start with
+template = chronicle.get_integration_logical_operator_template("MyIntegration")
+
+# 2. Create a custom logical operator for severity checking
+severity_operator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="Severity Level Check",
+ description="Checks if severity meets minimum threshold",
+ script="""
+def evaluate(severity, min_severity='MEDIUM'):
+ severity_levels = {
+ 'LOW': 1,
+ 'MEDIUM': 2,
+ 'HIGH': 3,
+ 'CRITICAL': 4
+ }
+
+ current_level = severity_levels.get(severity.upper(), 0)
+ min_level = severity_levels.get(min_severity.upper(), 0)
+
+ return current_level >= min_level
+""",
+ script_timeout="30s",
+ enabled=False, # Start disabled for testing
+ parameters=[
+ {
+ "name": "severity",
+ "type": "STRING",
+ "displayName": "Event Severity",
+ "mandatory": True
+ },
+ {
+ "name": "min_severity",
+ "type": "STRING",
+ "displayName": "Minimum Severity",
+ "mandatory": False,
+ "defaultValue": "MEDIUM"
+ }
+ ]
+)
+
+# 3. Test the operator before enabling
+test_result = chronicle.execute_integration_logical_operator_test(
+ integration_name="MyIntegration",
+ logical_operator=severity_operator
+)
+
+# 4. If test is successful, enable the operator
+if test_result.get('resultValue') is not None:
+ operator_id = severity_operator.get('name').split('/')[-1]
+ enabled_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id=operator_id,
+ enabled=True
+ )
+ print(f"Operator enabled: {enabled_operator.get('name')}")
+else:
+ print(f"Test failed: {test_result.get('debugOutputMessage')}")
+
+# 5. Create additional operators for workflow automation
+# IP address validation operator
+ip_validator = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="IP Address Validator",
+ description="Validates if a string is a valid IP address",
+ script="""
+def evaluate(ip_string):
+ import ipaddress
+ try:
+ ipaddress.ip_address(ip_string)
+ return True
+ except ValueError:
+ return False
+""",
+ script_timeout="30s",
+ enabled=True
+)
+
+# Time range checker
+time_checker = chronicle.create_integration_logical_operator(
+ integration_name="MyIntegration",
+ display_name="Business Hours Checker",
+ description="Checks if timestamp falls within business hours",
+ script="""
+def evaluate(timestamp, start_hour=9, end_hour=17):
+ from datetime import datetime
+
+ dt = datetime.fromisoformat(timestamp.replace('Z', '+00:00'))
+ hour = dt.hour
+
+ return start_hour <= hour < end_hour
+""",
+ script_timeout="30s",
+ enabled=True,
+ parameters=[
+ {
+ "name": "timestamp",
+ "type": "STRING",
+ "displayName": "Timestamp",
+ "mandatory": True
+ },
+ {
+ "name": "start_hour",
+ "type": "INTEGER",
+ "displayName": "Business Day Start Hour",
+ "mandatory": False,
+ "defaultValue": "9"
+ },
+ {
+ "name": "end_hour",
+ "type": "INTEGER",
+ "displayName": "Business Day End Hour",
+ "mandatory": False,
+ "defaultValue": "17"
+ }
+ ]
+)
+
+# 6. List all logical operators for the integration
+all_operators = chronicle.list_integration_logical_operators(
+ integration_name="MyIntegration",
+ as_list=True
+)
+print(f"Total logical operators: {len(all_operators)}")
+for op in all_operators:
+ print(f" - {op.get('displayName')} (Enabled: {op.get('enabled')})")
+```
+
+### Integration Logical Operator Revisions
+
+List all revisions for a logical operator:
+
+```python
+# Get all revisions for a logical operator
+revisions = chronicle.list_integration_logical_operator_revisions(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+for revision in revisions.get("revisions", []):
+ print(f"Revision: {revision.get('name')}, Comment: {revision.get('comment')}")
+
+# Get all revisions as a list
+revisions = chronicle.list_integration_logical_operator_revisions(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ as_list=True
+)
+
+# Filter revisions
+revisions = chronicle.list_integration_logical_operator_revisions(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ filter_string='version = "1.0"',
+ order_by="createTime desc"
+)
+```
+
+Delete a specific logical operator revision:
+
+```python
+chronicle.delete_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ revision_id="rev-456"
+)
+```
+
+Create a new revision before making changes:
+
+```python
+# Get the current logical operator
+logical_operator = chronicle.get_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+
+# Create a backup revision
+new_revision = chronicle.create_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ comment="Backup before refactoring conditional logic"
+)
+print(f"Created revision: {new_revision.get('name')}")
+
+# Create revision with custom comment
+new_revision = chronicle.create_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ comment="Version 2.0 - Enhanced comparison logic"
+)
+```
+
+Rollback to a previous revision:
+
+```python
+# Rollback to a previous working version
+rollback_result = chronicle.rollback_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ revision_id="rev-456"
+)
+print(f"Rolled back to: {rollback_result.get('name')}")
+```
+
+Example workflow: Safe logical operator updates with revision control:
+
+```python
+# 1. Get the current logical operator
+logical_operator = chronicle.get_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1"
+)
+
+# 2. Create a backup revision
+backup = chronicle.create_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ comment="Backup before updating evaluation logic"
+)
+
+# 3. Make changes to the logical operator
+updated_operator = chronicle.update_integration_logical_operator(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ display_name="Enhanced Conditional Operator",
+ script="""
+def evaluate(severity, threshold, include_medium=False):
+ severity_levels = {
+ 'LOW': 1,
+ 'MEDIUM': 2,
+ 'HIGH': 3,
+ 'CRITICAL': 4
+ }
+
+ current = severity_levels.get(severity.upper(), 0)
+ min_level = severity_levels.get(threshold.upper(), 0)
+
+ if include_medium and current >= severity_levels['MEDIUM']:
+ return True
+
+ return current >= min_level
+"""
+)
+
+# 4. Test the updated logical operator
+test_result = chronicle.execute_integration_logical_operator_test(
+ integration_name="MyIntegration",
+ logical_operator=updated_operator
+)
+
+# 5. If test fails, rollback to backup
+if test_result.get("resultValue") is None or "error" in test_result.get("debugOutputMessage", "").lower():
+ print("Test failed - rolling back")
+ chronicle.rollback_integration_logical_operator_revision(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ revision_id=backup.get("name").split("/")[-1]
+ )
+else:
+ print("Test passed - logical operator updated successfully")
+
+# 6. List all revisions to see history
+all_revisions = chronicle.list_integration_logical_operator_revisions(
+ integration_name="MyIntegration",
+ logical_operator_id="lo1",
+ as_list=True
+)
+print(f"Total revisions: {len(all_revisions)}")
+for rev in all_revisions:
+ print(f" - {rev.get('comment', 'No comment')} (ID: {rev.get('name').split('/')[-1]})")
+```
+
+
## Rule Management
The SDK provides comprehensive support for managing Chronicle detection rules:
diff --git a/api_module_mapping.md b/api_module_mapping.md
index bcfa632d..3d006a93 100644
--- a/api_module_mapping.md
+++ b/api_module_mapping.md
@@ -7,10 +7,643 @@ Following shows mapping between SecOps [REST Resource](https://cloud.google.com/
## Implementation Statistics
- **v1:** 17 endpoints implemented
-- **v1alpha:** 113 endpoints implemented
+- **v1beta:** 88 endpoints implemented
+- **v1alpha:** 203 endpoints implemented
## Endpoint Mapping
+| REST Resource | Version | secops-wrapper module | CLI Command |
+|--------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------|
+| dataAccessLabels.create | v1 | | |
+| dataAccessLabels.delete | v1 | | |
+| dataAccessLabels.get | v1 | | |
+| dataAccessLabels.list | v1 | | |
+| dataAccessLabels.patch | v1 | | |
+| dataAccessScopes.create | v1 | | |
+| dataAccessScopes.delete | v1 | | |
+| dataAccessScopes.get | v1 | | |
+| dataAccessScopes.list | v1 | | |
+| dataAccessScopes.patch | v1 | | |
+| get | v1 | | |
+| operations.cancel | v1 | | |
+| operations.delete | v1 | | |
+| operations.get | v1 | | |
+| operations.list | v1 | | |
+| referenceLists.create | v1 | chronicle.reference_list.create_reference_list | secops reference-list create |
+| referenceLists.get | v1 | chronicle.reference_list.get_reference_list | secops reference-list get |
+| referenceLists.list | v1 | chronicle.reference_list.list_reference_lists | secops reference-list list |
+| referenceLists.patch | v1 | chronicle.reference_list.update_reference_list | secops reference-list update |
+| rules.create | v1 | chronicle.rule.create_rule | secops rule create |
+| rules.delete | v1 | chronicle.rule.delete_rule | secops rule delete |
+| rules.deployments.list | v1 | | |
+| rules.get | v1 | chronicle.rule.get_rule | secops rule get |
+| rules.getDeployment | v1 | | |
+| rules.list | v1 | chronicle.rule.list_rules | secops rule list |
+| rules.listRevisions | v1 | | |
+| rules.patch | v1 | chronicle.rule.update_rule | secops rule update |
+| rules.retrohunts.create | v1 | chronicle.rule_retrohunt.create_retrohunt | secops rule-retrohunt create |
+| rules.retrohunts.get | v1 | chronicle.rule_retrohunt.get_retrohunt | secops rule-retrohunt get |
+| rules.retrohunts.list | v1 | chronicle.rule_retrohunt.list_retrohunts | secops rule-retrohunt list |
+| rules.updateDeployment | v1 | chronicle.rule.enable_rule | secops rule enable |
+| watchlists.create | v1 | chronicle.watchlist.create_watchlist | secops watchlist create |
+| watchlists.delete | v1 | chronicle.watchlist.delete_watchlist | secops watchlist delete |
+| watchlists.get | v1 | chronicle.watchlist.get_watchlist | secops watchlist get |
+| watchlists.list | v1 | chronicle.watchlist.list_watchlists | secops watchlist list |
+| watchlists.patch | v1 | chronicle.watchlist.update_watchlist | secops watchlist update |
+| dataAccessLabels.create | v1beta | | |
+| dataAccessLabels.delete | v1beta | | |
+| dataAccessLabels.get | v1beta | | |
+| dataAccessLabels.list | v1beta | | |
+| dataAccessLabels.patch | v1beta | | |
+| dataAccessScopes.create | v1beta | | |
+| dataAccessScopes.delete | v1beta | | |
+| dataAccessScopes.get | v1beta | | |
+| dataAccessScopes.list | v1beta | | |
+| dataAccessScopes.patch | v1beta | | |
+| get | v1beta | | |
+| integrations.create | v1beta | | |
+| integrations.delete | v1beta | chronicle.integration.integrations.delete_integration | secops integration integrations delete |
+| integrations.download | v1beta | chronicle.integration.integrations.download_integration | secops integration integrations download |
+| integrations.downloadDependency | v1beta | chronicle.integration.integrations.download_integration_dependency | secops integration integrations download-dependency |
+| integrations.exportIntegrationItems | v1beta | chronicle.integration.integrations.export_integration_items | secops integration integrations export-items |
+| integrations.fetchAffectedItems | v1beta | chronicle.integration.integrations.get_integration_affected_items | secops integration integrations get-affected-items |
+| integrations.fetchAgentIntegrations | v1beta | chronicle.integration.integrations.get_agent_integrations | secops integration integrations get-agent |
+| integrations.fetchCommercialDiff | v1beta | chronicle.integration.integrations.get_integration_diff | secops integration integrations get-diff |
+| integrations.fetchDependencies | v1beta | chronicle.integration.integrations.get_integration_dependencies | secops integration integrations get-dependencies |
+| integrations.fetchRestrictedAgents | v1beta | chronicle.integration.integrations.get_integration_restricted_agents | secops integration integrations get-restricted-agents |
+| integrations.get | v1beta | chronicle.integration.integrations.get_integration | secops integration integrations get |
+| integrations.getFetchProductionDiff | v1beta | chronicle.integration.integrations.get_integration_diff(diff_type=DiffType.PRODUCTION) | secops integration integrations get-diff |
+| integrations.getFetchStagingDiff | v1beta | chronicle.integration.integrations.get_integration_diff(diff_type=DiffType.STAGING) | secops integration integrations get-diff |
+| integrations.import | v1beta | | |
+| integrations.importIntegrationDependency | v1beta | | |
+| integrations.importIntegrationItems | v1beta | | |
+| integrations.list | v1beta | chronicle.integration.integrations.list_integrations | secops integration integrations list |
+| integrations.patch | v1beta | | |
+| integrations.pushToProduction | v1beta | chronicle.integration.integrations.transition_integration(target_mode=TargetMode.PRODUCTION) | secops integration integrations transition |
+| integrations.pushToStaging | v1beta | chronicle.integration.integrations.transition_integration(target_mode=TargetMode.STAGING) | secops integration integrations transition |
+| integrations.updateCustomIntegration | v1beta | | |
+| integrations.upload | v1beta | | |
+| integrations.actions.create | v1beta | chronicle.integration.actions.create_integration_action | secops integration actions create |
+| integrations.actions.delete | v1beta | chronicle.integration.actions.delete_integration_action | secops integration actions delete |
+| integrations.actions.executeTest | v1beta | chronicle.integration.actions.execute_integration_action_test | secops integration actions test |
+| integrations.actions.fetchActionsByEnvironment | v1beta | chronicle.integration.actions.get_integration_actions_by_environment | |
+| integrations.actions.fetchTemplate | v1beta | chronicle.integration.actions.get_integration_action_template | secops integration actions template |
+| integrations.actions.get | v1beta | chronicle.integration.actions.get_integration_action | secops integration actions get |
+| integrations.actions.list | v1beta | chronicle.integration.actions.list_integration_actions | secops integration actions list |
+| integrations.actions.patch | v1beta | chronicle.integration.actions.update_integration_action | secops integration actions update |
+| integrations.actions.revisions.create | v1beta | chronicle.integration.action_revisions.create_integration_action_revision | secops integration action-revisions create |
+| integrations.actions.revisions.delete | v1beta | chronicle.integration.action_revisions.delete_integration_action_revision | secops integration action-revisions delete |
+| integrations.actions.revisions.list | v1beta | chronicle.integration.action_revisions.list_integration_action_revisions | secops integration action-revisions list |
+| integrations.actions.revisions.rollback | v1beta | chronicle.integration.action_revisions.rollback_integration_action_revision | secops integration action-revisions rollback |
+| integrations.connectors.create | v1beta | chronicle.integration.connectors.create_integration_connector | secops integration connectors create |
+| integrations.connectors.delete | v1beta | chronicle.integration.connectors.delete_integration_connector | secops integration connectors delete |
+| integrations.connectors.executeTest | v1beta | chronicle.integration.connectors.execute_integration_connector_test | secops integration connectors test |
+| integrations.connectors.fetchTemplate | v1beta | chronicle.integration.connectors.get_integration_connector_template | secops integration connectors template |
+| integrations.connectors.get | v1beta | chronicle.integration.connectors.get_integration_connector | secops integration connectors get |
+| integrations.connectors.list | v1beta | chronicle.integration.connectors.list_integration_connectors | secops integration connectors list |
+| integrations.connectors.patch | v1beta | chronicle.integration.connectors.update_integration_connector | secops integration connectors update |
+| integrations.connectors.revisions.create | v1beta | chronicle.integration.connector_revisions.create_integration_connector_revision | secops integration connector-revisions create |
+| integrations.connectors.revisions.delete | v1beta | chronicle.integration.connector_revisions.delete_integration_connector_revision | secops integration connector-revisions delete |
+| integrations.connectors.revisions.list | v1beta | chronicle.integration.connector_revisions.list_integration_connector_revisions | secops integration connector-revisions list |
+| integrations.connectors.revisions.rollback | v1beta | chronicle.integration.connector_revisions.rollback_integration_connector_revision | secops integration connector-revisions rollback|
+| integrations.connectors.contextProperties.clearAll | v1beta | chronicle.integration.connector_context_properties.delete_all_connector_context_properties | secops integration connector-context-properties delete-all |
+| integrations.connectors.contextProperties.create | v1beta | chronicle.integration.connector_context_properties.create_connector_context_property | secops integration connector-context-properties create |
+| integrations.connectors.contextProperties.delete | v1beta | chronicle.integration.connector_context_properties.delete_connector_context_property | secops integration connector-context-properties delete |
+| integrations.connectors.contextProperties.get | v1beta | chronicle.integration.connector_context_properties.get_connector_context_property | secops integration connector-context-properties get |
+| integrations.connectors.contextProperties.list | v1beta | chronicle.integration.connector_context_properties.list_connector_context_properties | secops integration connector-context-properties list |
+| integrations.connectors.contextProperties.patch | v1beta | chronicle.integration.connector_context_properties.update_connector_context_property | secops integration connector-context-properties update |
+| integrations.connectors.connectorInstances.logs.get | v1beta | chronicle.integration.connector_instance_logs.get_connector_instance_log | secops integration connector-instance-logs get |
+| integrations.connectors.connectorInstances.logs.list | v1beta | chronicle.integration.connector_instance_logs.list_connector_instance_logs | secops integration connector-instance-logs list|
+| integrations.connectors.connectorInstances.create | v1beta | chronicle.integration.connector_instances.create_connector_instance | secops integration connector-instances create |
+| integrations.connectors.connectorInstances.delete | v1beta | chronicle.integration.connector_instances.delete_connector_instance | secops integration connector-instances delete |
+| integrations.connectors.connectorInstances.fetchLatestDefinition | v1beta | chronicle.integration.connector_instances.get_connector_instance_latest_definition | secops integration connector-instances get-latest-definition |
+| integrations.connectors.connectorInstances.get | v1beta | chronicle.integration.connector_instances.get_connector_instance | secops integration connector-instances get |
+| integrations.connectors.connectorInstances.list | v1beta | chronicle.integration.connector_instances.list_connector_instances | secops integration connector-instances list |
+| integrations.connectors.connectorInstances.patch | v1beta | chronicle.integration.connector_instances.update_connector_instance | secops integration connector-instances update |
+| integrations.connectors.connectorInstances.runOnDemand | v1beta | chronicle.integration.connector_instances.run_connector_instance_on_demand | secops integration connector-instances run-on-demand |
+| integrations.connectors.connectorInstances.setLogsCollection | v1beta | chronicle.integration.connector_instances.set_connector_instance_logs_collection | secops integration connector-instances set-logs-collection |
+| integrations.integrationInstances.create | v1beta | chronicle.integration.integration_instances.create_integration_instance | secops integration instances create |
+| integrations.integrationInstances.delete | v1beta | chronicle.integration.integration_instances.delete_integration_instance | secops integration instances delete |
+| integrations.integrationInstances.executeTest | v1beta | chronicle.integration.integration_instances.execute_integration_instance_test | secops integration instances test |
+| integrations.integrationInstances.fetchAffectedItems | v1beta | chronicle.integration.integration_instances.get_integration_instance_affected_items | secops integration instances get-affected-items|
+| integrations.integrationInstances.fetchDefaultInstance | v1beta | chronicle.integration.integration_instances.get_default_integration_instance | secops integration instances get-default |
+| integrations.integrationInstances.get | v1beta | chronicle.integration.integration_instances.get_integration_instance | secops integration instances get |
+| integrations.integrationInstances.list | v1beta | chronicle.integration.integration_instances.list_integration_instances | secops integration instances list |
+| integrations.integrationInstances.patch | v1beta | chronicle.integration.integration_instances.update_integration_instance | secops integration instances update |
+| integrations.jobs.create | v1beta | chronicle.integration.jobs.create_integration_job | secops integration jobs create |
+| integrations.jobs.delete | v1beta | chronicle.integration.jobs.delete_integration_job | secops integration jobs delete |
+| integrations.jobs.executeTest | v1beta | chronicle.integration.jobs.execute_integration_job_test | secops integration jobs test |
+| integrations.jobs.fetchTemplate | v1beta | chronicle.integration.jobs.get_integration_job_template | secops integration jobs template |
+| integrations.jobs.get | v1beta | chronicle.integration.jobs.get_integration_job | secops integration jobs get |
+| integrations.jobs.list | v1beta | chronicle.integration.jobs.list_integration_jobs | secops integration jobs list |
+| integrations.jobs.patch | v1beta | chronicle.integration.jobs.update_integration_job | secops integration jobs update |
+| integrations.managers.create | v1beta | chronicle.integration.managers.create_integration_manager | secops integration managers create |
+| integrations.managers.delete | v1beta | chronicle.integration.managers.delete_integration_manager | secops integration managers delete |
+| integrations.managers.fetchTemplate | v1beta | chronicle.integration.managers.get_integration_manager_template | secops integration managers template |
+| integrations.managers.get | v1beta | chronicle.integration.managers.get_integration_manager | secops integration managers get |
+| integrations.managers.list | v1beta | chronicle.integration.managers.list_integration_managers | secops integration managers list |
+| integrations.managers.patch | v1beta | chronicle.integration.managers.update_integration_manager | secops integration managers update |
+| integrations.managers.revisions.create | v1beta | chronicle.integration.manager_revisions.create_integration_manager_revision | secops integration manager-revisions create |
+| integrations.managers.revisions.delete | v1beta | chronicle.integration.manager_revisions.delete_integration_manager_revision | secops integration manager-revisions delete |
+| integrations.managers.revisions.get | v1beta | chronicle.integration.manager_revisions.get_integration_manager_revision | secops integration manager-revisions get |
+| integrations.managers.revisions.list | v1beta | chronicle.integration.manager_revisions.list_integration_manager_revisions | secops integration manager-revisions list |
+| integrations.managers.revisions.rollback | v1beta | chronicle.integration.manager_revisions.rollback_integration_manager_revision | secops integration manager-revisions rollback |
+| integrations.jobs.revisions.create | v1beta | chronicle.integration.job_revisions.create_integration_job_revision | secops integration job-revisions create |
+| integrations.jobs.revisions.delete | v1beta | chronicle.integration.job_revisions.delete_integration_job_revision | secops integration job-revisions delete |
+| integrations.jobs.revisions.list | v1beta | chronicle.integration.job_revisions.list_integration_job_revisions | secops integration job-revisions list |
+| integrations.jobs.revisions.rollback | v1beta | chronicle.integration.job_revisions.rollback_integration_job_revision | secops integration job-revisions rollback |
+| integrations.jobs.jobInstances.create | v1beta | chronicle.integration.job_instances.create_integration_job_instance | secops integration job-instances create |
+| integrations.jobs.jobInstances.delete | v1beta | chronicle.integration.job_instances.delete_integration_job_instance | secops integration job-instances delete |
+| integrations.jobs.jobInstances.get | v1beta | chronicle.integration.job_instances.get_integration_job_instance | secops integration job-instances get |
+| integrations.jobs.jobInstances.list | v1beta | chronicle.integration.job_instances.list_integration_job_instances | secops integration job-instances list |
+| integrations.jobs.jobInstances.patch | v1beta | chronicle.integration.job_instances.update_integration_job_instance | secops integration job-instances update |
+| integrations.jobs.jobInstances.runOnDemand | v1beta | chronicle.integration.job_instances.run_integration_job_instance_on_demand | secops integration job-instances run-on-demand |
+| integrations.jobs.contextProperties.clearAll | v1beta | chronicle.integration.job_context_properties.delete_all_job_context_properties | secops integration job-context-properties delete-all |
+| integrations.jobs.contextProperties.create | v1beta | chronicle.integration.job_context_properties.create_job_context_property | secops integration job-context-properties create |
+| integrations.jobs.contextProperties.delete | v1beta | chronicle.integration.job_context_properties.delete_job_context_property | secops integration job-context-properties delete |
+| integrations.jobs.contextProperties.get | v1beta | chronicle.integration.job_context_properties.get_job_context_property | secops integration job-context-properties get |
+| integrations.jobs.contextProperties.list | v1beta | chronicle.integration.job_context_properties.list_job_context_properties | secops integration job-context-properties list |
+| integrations.jobs.contextProperties.patch | v1beta | chronicle.integration.job_context_properties.update_job_context_property | secops integration job-context-properties update |
+| integrations.jobs.jobInstances.logs.get | v1beta | chronicle.integration.job_instance_logs.get_job_instance_log | secops integration job-instance-logs get |
+| integrations.jobs.jobInstances.logs.list | v1beta | chronicle.integration.job_instance_logs.list_job_instance_logs | secops integration job-instance-logs list |
+| marketplaceIntegrations.get | v1beta | chronicle.marketplace_integrations.get_marketplace_integration | secops integration marketplace get |
+| marketplaceIntegrations.getDiff | v1beta | chronicle.marketplace_integrations.get_marketplace_integration_diff | secops integration marketplace diff |
+| marketplaceIntegrations.install | v1beta | chronicle.marketplace_integrations.install_marketplace_integration | secops integration marketplace install |
+| marketplaceIntegrations.list | v1beta | chronicle.marketplace_integrations.list_marketplace_integrations | secops integration marketplace list |
+| marketplaceIntegrations.uninstall | v1beta | chronicle.marketplace_integrations.uninstall_marketplace_integration | secops integration marketplace uninstall |
+| operations.cancel | v1beta | | |
+| operations.delete | v1beta | | |
+| operations.get | v1beta | | |
+| operations.list | v1beta | | |
+| referenceLists.create | v1beta | | |
+| referenceLists.get | v1beta | | |
+| referenceLists.list | v1beta | | |
+| referenceLists.patch | v1beta | | |
+| rules.create | v1beta | | |
+| rules.delete | v1beta | | |
+| rules.deployments.list | v1beta | | |
+| rules.get | v1beta | | |
+| rules.getDeployment | v1beta | | |
+| rules.list | v1beta | | |
+| rules.listRevisions | v1beta | | |
+| rules.patch | v1beta | | |
+| rules.retrohunts.create | v1beta | | |
+| rules.retrohunts.get | v1beta | | |
+| rules.retrohunts.list | v1beta | | |
+| rules.updateDeployment | v1beta | | |
+| watchlists.create | v1beta | | |
+| watchlists.delete | v1beta | | |
+| watchlists.get | v1beta | | |
+| watchlists.list | v1beta | | |
+| watchlists.patch | v1beta | | |
+| analytics.entities.analyticValues.list | v1alpha | | |
+| analytics.list | v1alpha | | |
+| batchValidateWatchlistEntities | v1alpha | | |
+| bigQueryAccess.provide | v1alpha | | |
+| bigQueryExport.provision | v1alpha | | |
+| cases.countPriorities | v1alpha | | |
+| contentHub.featuredContentRules.list | v1alpha | chronicle.featured_content_rules.list_featured_content_rules | secops featured-content-rules list |
+| curatedRuleSetCategories.curatedRuleSets.curatedRuleSetDeployments.batchUpdate | v1alpha | chronicle.rule_set.batch_update_curated_rule_set_deployments | |
+| curatedRuleSetCategories.curatedRuleSets.curatedRuleSetDeployments.patch | v1alpha | chronicle.rule_set.update_curated_rule_set_deployment | secops curated-rule rule-set-deployment update |
+| curatedRuleSetCategories.curatedRuleSets.curatedRuleSetDeployments.list | v1alpha | chronicle.rule_set.list_curated_rule_set_deployments | secops curated-rule rule-set-deployment list |
+| curatedRuleSetCategories.curatedRuleSets.curatedRuleSetDeployments.get | v1alpha | chronicle.rule_set.get_curated_rule_set_deployment
chronicle.rule_set.get_curated_rule_set_deployment_by_name | secops curated-rule rule-set-deployment get |
+| curatedRuleSetCategories.curatedRuleSets.get | v1alpha | chronicle.rule_set.get_curated_rule_set | secops curated-rule rule-set get |
+| curatedRuleSetCategories.curatedRuleSets.list | v1alpha | chronicle.rule_set.list_curated_rule_sets | secops curated-rule rule-set list |
+| curatedRuleSetCategories.get | v1alpha | chronicle.rule_set.get_curated_rule_set_category | secops curated-rule rule-set-category get |
+| curatedRuleSetCategories.list | v1alpha | chronicle.rule_set.list_curated_rule_set_categories | secops curated-rule rule-set-category list |
+| curatedRules.get | v1alpha | chronicle.rule_set.get_curated_rule
chronicle.rule_set.get_curated_rule_by_name | secops curated-rule rule get |
+| curatedRules.list | v1alpha | chronicle.rule_set.list_curated_rules | secops curated-rule rule list |
+| dashboardCharts.batchGet | v1alpha | | |
+| dashboardCharts.get | v1alpha | chronicle.dashboard.get_chart | secops dashboard get-chart |
+| dashboardQueries.execute | v1alpha | chronicle.dashboard_query.execute_query | secops dashboard-query execute |
+| dashboardQueries.get | v1alpha | chronicle.dashboard_query.get_execute_query | secops dashboard-query get |
+| dashboards.copy | v1alpha | | |
+| dashboards.create | v1alpha | | |
+| dashboards.delete | v1alpha | | |
+| dashboards.get | v1alpha | | |
+| dashboards.list | v1alpha | | |
+| dataAccessLabels.create | v1alpha | | |
+| dataAccessLabels.delete | v1alpha | | |
+| dataAccessLabels.get | v1alpha | | |
+| dataAccessLabels.list | v1alpha | | |
+| dataAccessLabels.patch | v1alpha | | |
+| dataAccessScopes.create | v1alpha | | |
+| dataAccessScopes.delete | v1alpha | | |
+| dataAccessScopes.get | v1alpha | | |
+| dataAccessScopes.list | v1alpha | | |
+| dataAccessScopes.patch | v1alpha | | |
+| dataExports.cancel | v1alpha | chronicle.data_export.cancel_data_export | secops export cancel |
+| dataExports.create | v1alpha | chronicle.data_export.create_data_export | secops export create |
+| dataExports.fetchavailablelogtypes | v1alpha | chronicle.data_export.fetch_available_log_types | secops export log-types |
+| dataExports.get | v1alpha | chronicle.data_export.get_data_export | secops export status |
+| dataExports.list | v1alpha | chronicle.data_export.list_data_export | secops export list |
+| dataExports.patch | v1alpha | chronicle.data_export.update_data_export | secops export update |
+| dataTableOperationErrors.get | v1alpha | | |
+| dataTables.create | v1alpha | chronicle.data_table.create_data_table | secops data-table create |
+| dataTables.dataTableRows.bulkCreate | v1alpha | chronicle.data_table.create_data_table_rows | secops data-table add-rows |
+| dataTables.dataTableRows.bulkCreateAsync | v1alpha | | |
+| dataTables.dataTableRows.bulkGet | v1alpha | | |
+| dataTables.dataTableRows.bulkReplace | v1alpha | chronicle.data_table.replace_data_table_rows | secops data-table replace-rows |
+| dataTables.dataTableRows.bulkReplaceAsync | v1alpha | | |
+| dataTables.dataTableRows.bulkUpdate | v1alpha | chronicle.data_table.update_data_table_rows | secops data-table update-rows |
+| dataTables.dataTableRows.bulkUpdateAsync | v1alpha | | |
+| dataTables.dataTableRows.create | v1alpha | | |
+| dataTables.dataTableRows.delete | v1alpha | chronicle.data_table.delete_data_table_rows | secops data-table delete-rows |
+| dataTables.dataTableRows.get | v1alpha | | |
+| dataTables.dataTableRows.list | v1alpha | chronicle.data_table.list_data_table_rows | secops data-table list-rows |
+| dataTables.dataTableRows.patch | v1alpha | | |
+| dataTables.delete | v1alpha | chronicle.data_table.delete_data_table | secops data-table delete |
+| dataTables.get | v1alpha | chronicle.data_table.get_data_table | secops data-table get |
+| dataTables.list | v1alpha | chronicle.data_table.list_data_tables | secops data-table list |
+| dataTables.patch | v1alpha | | |
+| dataTables.upload | v1alpha | | |
+| dataTaps.create | v1alpha | | |
+| dataTaps.delete | v1alpha | | |
+| dataTaps.get | v1alpha | | |
+| dataTaps.list | v1alpha | | |
+| dataTaps.patch | v1alpha | | |
+| delete | v1alpha | | |
+| enrichmentControls.create | v1alpha | | |
+| enrichmentControls.delete | v1alpha | | |
+| enrichmentControls.get | v1alpha | | |
+| enrichmentControls.list | v1alpha | | |
+| entities.get | v1alpha | | |
+| entities.import | v1alpha | chronicle.log_ingest.import_entities | secops entity import |
+| entities.modifyEntityRiskScore | v1alpha | | |
+| entities.queryEntityRiskScoreModifications | v1alpha | | |
+| entityRiskScores.query | v1alpha | | |
+| errorNotificationConfigs.create | v1alpha | | |
+| errorNotificationConfigs.delete | v1alpha | | |
+| errorNotificationConfigs.get | v1alpha | | |
+| errorNotificationConfigs.list | v1alpha | | |
+| errorNotificationConfigs.patch | v1alpha | | |
+| events.batchGet | v1alpha | | |
+| events.get | v1alpha | | |
+| events.import | v1alpha | chronicle.log_ingest.ingest_udm | secops log ingest-udm |
+| extractSyslog | v1alpha | | |
+| federationGroups.create | v1alpha | | |
+| federationGroups.delete | v1alpha | | |
+| federationGroups.get | v1alpha | | |
+| federationGroups.list | v1alpha | | |
+| federationGroups.patch | v1alpha | | |
+| feedPacks.get | v1alpha | | |
+| feedPacks.list | v1alpha | | |
+| feedServiceAccounts.fetchServiceAccountForCustomer | v1alpha | | |
+| feedSourceTypeSchemas.list | v1alpha | | |
+| feedSourceTypeSchemas.logTypeSchemas.list | v1alpha | | |
+| feeds.create | v1alpha | chronicle.feeds.create_feed | secops feed create |
+| feeds.delete | v1alpha | chronicle.feeds.delete_feed | secops feed delete |
+| feeds.disable | v1alpha | chronicle.feeds.disable_feed | secops feed disable |
+| feeds.enable | v1alpha | chronicle.feeds.enable_feed | secops feed enable |
+| feeds.generateSecret | v1alpha | chronicle.feeds.generate_secret | secops feed secret |
+| feeds.get | v1alpha | chronicle.feeds.get_feed | secops feed get |
+| feeds.importPushLogs | v1alpha | | |
+| feeds.list | v1alpha | chronicle.feeds.list_feeds | secops feed list |
+| feeds.patch | v1alpha | chronicle.feeds.update_feed | secops feed update |
+| feeds.scheduleTransfer | v1alpha | | |
+| fetchFederationAccess | v1alpha | | |
+| findEntity | v1alpha | | |
+| findEntityAlerts | v1alpha | | |
+| findRelatedEntities | v1alpha | | |
+| findUdmFieldValues | v1alpha | | |
+| findingsGraph.exploreNode | v1alpha | | |
+| findingsGraph.initializeGraph | v1alpha | | |
+| findingsRefinements.computeFindingsRefinementActivity | v1alpha | chronicle.rule_exclusion.compute_rule_exclusion_activity | secops rule-exclusion compute-activity |
+| findingsRefinements.create | v1alpha | chronicle.rule_exclusion.create_rule_exclusion | secops rule-exclusion create |
+| findingsRefinements.get | v1alpha | chronicle.rule_exclusion.get_rule_exclusion | secops rule-exclusion get |
+| findingsRefinements.getDeployment | v1alpha | chronicle.rule_exclusion.get_rule_exclusion_deployment | secops rule-exclusion get-deployment |
+| findingsRefinements.list | v1alpha | chronicle.rule_exclusion.list_rule_exclusions | secops rule-exclusion list |
+| findingsRefinements.patch | v1alpha | chronicle.rule_exclusion.patch_rule_exclusion | secops rule-exclusion update |
+| findingsRefinements.updateDeployment | v1alpha | chronicle.rule_exclusion.update_rule_exclusion_deployment | secops rule-exclusion update-deployment |
+| forwarders.collectors.create | v1alpha | | |
+| forwarders.collectors.delete | v1alpha | | |
+| forwarders.collectors.get | v1alpha | | |
+| forwarders.collectors.list | v1alpha | | |
+| forwarders.collectors.patch | v1alpha | | |
+| forwarders.create | v1alpha | chronicle.log_ingest.create_forwarder | secops forwarder create |
+| forwarders.delete | v1alpha | chronicle.log_ingest.delete_forwarder | secops forwarder delete |
+| forwarders.generateForwarderFiles | v1alpha | | |
+| forwarders.get | v1alpha | chronicle.log_ingest.get_forwarder | secops forwarder get |
+| forwarders.importStatsEvents | v1alpha | | |
+| forwarders.list | v1alpha | chronicle.log_ingest.list_forwarder | secops forwarder list |
+| forwarders.patch | v1alpha | chronicle.log_ingest.update_forwarder | secops forwarder update |
+| generateCollectionAgentAuth | v1alpha | | |
+| generateSoarAuthJwt | v1alpha | | |
+| generateUdmKeyValueMappings | v1alpha | | |
+| generateWorkspaceConnectionToken | v1alpha | | |
+| get | v1alpha | | |
+| getBigQueryExport | v1alpha | | |
+| getMultitenantDirectory | v1alpha | | |
+| getRiskConfig | v1alpha | | |
+| ingestionLogLabels.get | v1alpha | | |
+| ingestionLogLabels.list | v1alpha | | |
+| ingestionLogNamespaces.get | v1alpha | | |
+| ingestionLogNamespaces.list | v1alpha | | |
+| integrations.create | v1alpha | | |
+| integrations.delete | v1alpha | chronicle.integration.integrations.delete_integration(api_version=APIVersion.V1ALPHA) | secops integration integrations delete |
+| integrations.download | v1alpha | chronicle.integration.integrations.download_integration(api_version=APIVersion.V1ALPHA) | secops integration integrations download |
+| integrations.downloadDependency | v1alpha | chronicle.integration.integrations.download_integration_dependency(api_version=APIVersion.V1ALPHA) | secops integration integrations download-dependency |
+| integrations.exportIntegrationItems | v1alpha | chronicle.integration.integrations.export_integration_items(api_version=APIVersion.V1ALPHA) | secops integration integrations export-items |
+| integrations.fetchAffectedItems | v1alpha | chronicle.integration.integrations.get_integration_affected_items(api_version=APIVersion.V1ALPHA) | secops integration integrations get-affected-items |
+| integrations.fetchAgentIntegrations | v1alpha | chronicle.integration.integrations.get_agent_integrations(api_version=APIVersion.V1ALPHA) | secops integration integrations get-agent |
+| integrations.fetchCommercialDiff | v1alpha | chronicle.integration.integrations.get_integration_diff(api_version=APIVersion.V1ALPHA) | secops integration integrations get-diff |
+| integrations.fetchDependencies | v1alpha | chronicle.integration.integrations.get_integration_dependencies(api_version=APIVersion.V1ALPHA) | secops integration integrations get-dependencies |
+| integrations.fetchRestrictedAgents | v1alpha | chronicle.integration.integrations.get_integration_restricted_agents(api_version=APIVersion.V1ALPHA) | secops integration integrations get-restricted-agents |
+| integrations.get | v1alpha | chronicle.integration.integrations.get_integration(api_version=APIVersion.V1ALPHA) | secops integration integrations get |
+| integrations.getFetchProductionDiff | v1alpha | chronicle.integration.integrations.get_integration_diff(api_version=APIVersion.V1ALPHA, diff_type=DiffType.PRODUCTION) | secops integration integrations get-diff |
+| integrations.getFetchStagingDiff | v1alpha | chronicle.integration.integrations.get_integration_diffapi_version=APIVersion.V1ALPHA, (diff_type=DiffType.STAGING) | secops integration integrations get-diff |
+| integrations.import | v1alpha | | |
+| integrations.importIntegrationDependency | v1alpha | | |
+| integrations.importIntegrationItems | v1alpha | | |
+| integrations.list | v1alpha | chronicle.integration.integrations.list_integrations(api_version=APIVersion.V1ALPHA) | secops integration integrations list |
+| integrations.patch | v1alpha | | |
+| integrations.pushToProduction | v1alpha | chronicle.integration.integrations.transition_integration(api_version=APIVersion.V1ALPHA, target_mode=TargetMode.PRODUCTION) | secops integration integrations transition |
+| integrations.pushToStaging | v1alpha | chronicle.integration.integrations.transition_integration(api_version=APIVersion.V1ALPHA, target_mode=TargetMode.STAGING) | secops integration integrations transition |
+| integrations.updateCustomIntegration | v1alpha | | |
+| integrations.upload | v1alpha | | |
+| integrations.actions.create | v1alpha | chronicle.integration.actions.create_integration_action(api_version=APIVersion.V1ALPHA) | secops integration actions create |
+| integrations.actions.delete | v1alpha | chronicle.integration.actions.delete_integration_action(api_version=APIVersion.V1ALPHA) | secops integration actions delete |
+| integrations.actions.executeTest | v1alpha | chronicle.integration.actions.execute_integration_action_test(api_version=APIVersion.V1ALPHA) | secops integration actions test |
+| integrations.actions.fetchActionsByEnvironment | v1alpha | chronicle.integration.actions.get_integration_actions_by_environment(api_version=APIVersion.V1ALPHA) | |
+| integrations.actions.fetchTemplate | v1alpha | chronicle.integration.actions.get_integration_action_template(api_version=APIVersion.V1ALPHA) | secops integration actions template |
+| integrations.actions.get | v1alpha | chronicle.integration.actions.get_integration_action(api_version=APIVersion.V1ALPHA) | secops integration actions get |
+| integrations.actions.list | v1alpha | chronicle.integration.actions.list_integration_actions(api_version=APIVersion.V1ALPHA) | secops integration actions list |
+| integrations.actions.patch | v1alpha | chronicle.integration.actions.update_integration_action(api_version=APIVersion.V1ALPHA) | secops integration actions update |
+| integrations.actions.revisions.create | v1alpha | chronicle.integration.action_revisions.create_integration_action_revision(api_version=APIVersion.V1ALPHA) | secops integration action-revisions create |
+| integrations.actions.revisions.delete | v1alpha | chronicle.integration.action_revisions.delete_integration_action_revision(api_version=APIVersion.V1ALPHA) | secops integration action-revisions delete |
+| integrations.actions.revisions.list | v1alpha | chronicle.integration.action_revisions.list_integration_action_revisions(api_version=APIVersion.V1ALPHA) | secops integration action-revisions list |
+| integrations.actions.revisions.rollback | v1alpha | chronicle.integration.action_revisions.rollback_integration_action_revision(api_version=APIVersion.V1ALPHA) | secops integration action-revisions rollback |
+| integrations.connectors.create | v1alpha | chronicle.integration.connectors.create_integration_connector(api_version=APIVersion.V1ALPHA) | secops integration connectors create |
+| integrations.connectors.delete | v1alpha | chronicle.integration.connectors.delete_integration_connector(api_version=APIVersion.V1ALPHA) | secops integration connectors delete |
+| integrations.connectors.executeTest | v1alpha | chronicle.integration.connectors.execute_integration_connector_test(api_version=APIVersion.V1ALPHA) | secops integration connectors test |
+| integrations.connectors.fetchTemplate | v1alpha | chronicle.integration.connectors.get_integration_connector_template(api_version=APIVersion.V1ALPHA) | secops integration connectors template |
+| integrations.connectors.get | v1alpha | chronicle.integration.connectors.get_integration_connector(api_version=APIVersion.V1ALPHA) | secops integration connectors get |
+| integrations.connectors.list | v1alpha | chronicle.integration.connectors.list_integration_connectors(api_version=APIVersion.V1ALPHA) | secops integration connectors list |
+| integrations.connectors.patch | v1alpha | chronicle.integration.connectors.update_integration_connector(api_version=APIVersion.V1ALPHA) | secops integration connectors update |
+| integrations.connectors.revisions.create | v1alpha | chronicle.integration.connector_revisions.create_integration_connector_revision(api_version=APIVersion.V1ALPHA) | secops integration connector-revisions create |
+| integrations.connectors.revisions.delete | v1alpha | chronicle.integration.connector_revisions.delete_integration_connector_revision(api_version=APIVersion.V1ALPHA) | secops integration connector-revisions delete |
+| integrations.connectors.revisions.list | v1alpha | chronicle.integration.connector_revisions.list_integration_connector_revisions(api_version=APIVersion.V1ALPHA) | secops integration connector-revisions list |
+| integrations.connectors.revisions.rollback | v1alpha | chronicle.integration.connector_revisions.rollback_integration_connector_revision(api_version=APIVersion.V1ALPHA) | secops integration connector-revisions rollback|
+| integrations.connectors.contextProperties.clearAll | v1alpha | chronicle.integration.connector_context_properties.delete_all_connector_context_properties(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties delete-all |
+| integrations.connectors.contextProperties.create | v1alpha | chronicle.integration.connector_context_properties.create_connector_context_property(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties create |
+| integrations.connectors.contextProperties.delete | v1alpha | chronicle.integration.connector_context_properties.delete_connector_context_property(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties delete |
+| integrations.connectors.contextProperties.get | v1alpha | chronicle.integration.connector_context_properties.get_connector_context_property(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties get |
+| integrations.connectors.contextProperties.list | v1alpha | chronicle.integration.connector_context_properties.list_connector_context_properties(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties list |
+| integrations.connectors.contextProperties.patch | v1alpha | chronicle.integration.connector_context_properties.update_connector_context_property(api_version=APIVersion.V1ALPHA) | secops integration connector-context-properties update |
+| integrations.connectors.connectorInstances.logs.get | v1alpha | chronicle.integration.connector_instance_logs.get_connector_instance_log(api_version=APIVersion.V1ALPHA) | secops integration connector-instance-logs get |
+| integrations.connectors.connectorInstances.logs.list | v1alpha | chronicle.integration.connector_instance_logs.list_connector_instance_logs(api_version=APIVersion.V1ALPHA) | secops integration connector-instance-logs list|
+| integrations.connectors.connectorInstances.create | v1alpha | chronicle.integration.connector_instances.create_connector_instance(api_version=APIVersion.V1ALPHA) | secops integration connector-instances create |
+| integrations.connectors.connectorInstances.delete | v1alpha | chronicle.integration.connector_instances.delete_connector_instance(api_version=APIVersion.V1ALPHA) | secops integration connector-instances delete |
+| integrations.connectors.connectorInstances.fetchLatestDefinition | v1alpha | chronicle.integration.connector_instances.get_connector_instance_latest_definition(api_version=APIVersion.V1ALPHA) | secops integration connector-instances get-latest-definition |
+| integrations.connectors.connectorInstances.get | v1alpha | chronicle.integration.connector_instances.get_connector_instance(api_version=APIVersion.V1ALPHA) | secops integration connector-instances get |
+| integrations.connectors.connectorInstances.list | v1alpha | chronicle.integration.connector_instances.list_connector_instances(api_version=APIVersion.V1ALPHA) | secops integration connector-instances list |
+| integrations.connectors.connectorInstances.patch | v1alpha | chronicle.integration.connector_instances.update_connector_instance(api_version=APIVersion.V1ALPHA) | secops integration connector-instances update |
+| integrations.connectors.connectorInstances.runOnDemand | v1alpha | chronicle.integration.connector_instances.run_connector_instance_on_demand(api_version=APIVersion.V1ALPHA) | secops integration connector-instances run-on-demand |
+| integrations.connectors.connectorInstances.setLogsCollection | v1alpha | chronicle.integration.connector_instances.set_connector_instance_logs_collection(api_version=APIVersion.V1ALPHA) | secops integration connector-instances set-logs-collection |
+| integrations.integrationInstances.create | v1alpha | chronicle.integration.integration_instances.create_integration_instance(api_version=APIVersion.V1ALPHA) | secops integration instances create |
+| integrations.integrationInstances.delete | v1alpha | chronicle.integration.integration_instances.delete_integration_instance(api_version=APIVersion.V1ALPHA) | secops integration instances delete |
+| integrations.integrationInstances.executeTest | v1alpha | chronicle.integration.integration_instances.execute_integration_instance_test(api_version=APIVersion.V1ALPHA) | secops integration instances test |
+| integrations.integrationInstances.fetchAffectedItems | v1alpha | chronicle.integration.integration_instances.get_integration_instance_affected_items(api_version=APIVersion.V1ALPHA) | secops integration instances get-affected-items|
+| integrations.integrationInstances.fetchDefaultInstance | v1alpha | chronicle.integration.integration_instances.get_default_integration_instance(api_version=APIVersion.V1ALPHA) | secops integration instances get-default |
+| integrations.integrationInstances.get | v1alpha | chronicle.integration.integration_instances.get_integration_instance(api_version=APIVersion.V1ALPHA) | secops integration instances get |
+| integrations.integrationInstances.list | v1alpha | chronicle.integration.integration_instances.list_integration_instances(api_version=APIVersion.V1ALPHA) | secops integration instances list |
+| integrations.integrationInstances.patch | v1alpha | chronicle.integration.integration_instances.update_integration_instance(api_version=APIVersion.V1ALPHA) | secops integration instances update |
+| integrations.transformers.create | v1alpha | chronicle.integration.transformers.create_integration_transformer | secops integration transformers create |
+| integrations.transformers.delete | v1alpha | chronicle.integration.transformers.delete_integration_transformer | secops integration transformers delete |
+| integrations.transformers.executeTest | v1alpha | chronicle.integration.transformers.execute_integration_transformer_test | secops integration transformers test |
+| integrations.transformers.fetchTemplate | v1alpha | chronicle.integration.transformers.get_integration_transformer_template | secops integration transformers template |
+| integrations.transformers.get | v1alpha | chronicle.integration.transformers.get_integration_transformer | secops integration transformers get |
+| integrations.transformers.list | v1alpha | chronicle.integration.transformers.list_integration_transformers | secops integration transformers list |
+| integrations.transformers.patch | v1alpha | chronicle.integration.transformers.update_integration_transformer | secops integration transformers update |
+| integrations.transformers.revisions.create | v1alpha | chronicle.integration.transformer_revisions.create_integration_transformer_revision | secops integration transformer-revisions create|
+| integrations.transformers.revisions.delete | v1alpha | chronicle.integration.transformer_revisions.delete_integration_transformer_revision | secops integration transformer-revisions delete|
+| integrations.transformers.revisions.list | v1alpha | chronicle.integration.transformer_revisions.list_integration_transformer_revisions | secops integration transformer-revisions list |
+| integrations.transformers.revisions.rollback | v1alpha | chronicle.integration.transformer_revisions.rollback_integration_transformer_revision | secops integration transformer-revisions rollback|
+| integrations.logicalOperators.create | v1alpha | chronicle.integration.logical_operators.create_integration_logical_operator | secops integration logical-operators create |
+| integrations.logicalOperators.delete | v1alpha | chronicle.integration.logical_operators.delete_integration_logical_operator | secops integration logical-operators delete |
+| integrations.logicalOperators.executeTest | v1alpha | chronicle.integration.logical_operators.execute_integration_logical_operator_test | secops integration logical-operators test |
+| integrations.logicalOperators.fetchTemplate | v1alpha | chronicle.integration.logical_operators.get_integration_logical_operator_template | secops integration logical-operators template |
+| integrations.logicalOperators.get | v1alpha | chronicle.integration.logical_operators.get_integration_logical_operator | secops integration logical-operators get |
+| integrations.logicalOperators.list | v1alpha | chronicle.integration.logical_operators.list_integration_logical_operators | secops integration logical-operators list |
+| integrations.logicalOperators.patch | v1alpha | chronicle.integration.logical_operators.update_integration_logical_operator | secops integration logical-operators update |
+| integrations.logicalOperators.revisions.create | v1alpha | chronicle.integration.logical_operator_revisions.create_integration_logical_operator_revision | secops integration logical-operator-revisions create |
+| integrations.logicalOperators.revisions.delete | v1alpha | chronicle.integration.logical_operator_revisions.delete_integration_logical_operator_revision | secops integration logical-operator-revisions delete |
+| integrations.logicalOperators.revisions.list | v1alpha | chronicle.integration.logical_operator_revisions.list_integration_logical_operator_revisions | secops integration logical-operator-revisions list |
+| integrations.logicalOperators.revisions.rollback | v1alpha | chronicle.integration.logical_operator_revisions.rollback_integration_logical_operator_revision | secops integration logical-operator-revisions rollback |
+| integrations.jobs.create | v1alpha | chronicle.integration.jobs.create_integration_job(api_version=APIVersion.V1ALPHA) | secops integration jobs create |
+| integrations.jobs.delete | v1alpha | chronicle.integration.jobs.delete_integration_job(api_version=APIVersion.V1ALPHA) | secops integration jobs delete |
+| integrations.jobs.executeTest | v1alpha | chronicle.integration.jobs.execute_integration_job_test(api_version=APIVersion.V1ALPHA) | secops integration jobs test |
+| integrations.jobs.fetchTemplate | v1alpha | chronicle.integration.jobs.get_integration_job_template(api_version=APIVersion.V1ALPHA) | secops integration jobs template |
+| integrations.jobs.get | v1alpha | chronicle.integration.jobs.get_integration_job(api_version=APIVersion.V1ALPHA) | secops integration jobs get |
+| integrations.jobs.list | v1alpha | chronicle.integration.jobs.list_integration_jobs(api_version=APIVersion.V1ALPHA) | secops integration jobs list |
+| integrations.jobs.patch | v1alpha | chronicle.integration.jobs.update_integration_job(api_version=APIVersion.V1ALPHA) | secops integration jobs update |
+| integrations.managers.create | v1alpha | chronicle.integration.managers.create_integration_manager(api_version=APIVersion.V1ALPHA) | secops integration managers create |
+| integrations.managers.delete | v1alpha | chronicle.integration.managers.delete_integration_manager(api_version=APIVersion.V1ALPHA) | secops integration managers delete |
+| integrations.managers.fetchTemplate | v1alpha | chronicle.integration.managers.get_integration_manager_template(api_version=APIVersion.V1ALPHA) | secops integration managers template |
+| integrations.managers.get | v1alpha | chronicle.integration.managers.get_integration_manager(api_version=APIVersion.V1ALPHA) | secops integration managers get |
+| integrations.managers.list | v1alpha | chronicle.integration.managers.list_integration_managers(api_version=APIVersion.V1ALPHA) | secops integration managers list |
+| integrations.managers.patch | v1alpha | chronicle.integration.managers.update_integration_manager(api_version=APIVersion.V1ALPHA) | secops integration managers update |
+| integrations.managers.revisions.create | v1alpha | chronicle.integration.manager_revisions.create_integration_manager_revision(api_version=APIVersion.V1ALPHA) | secops integration manager-revisions create |
+| integrations.managers.revisions.delete | v1alpha | chronicle.integration.manager_revisions.delete_integration_manager_revision(api_version=APIVersion.V1ALPHA) | secops integration manager-revisions delete |
+| integrations.managers.revisions.get | v1alpha | chronicle.integration.manager_revisions.get_integration_manager_revision(api_version=APIVersion.V1ALPHA) | secops integration manager-revisions get |
+| integrations.managers.revisions.list | v1alpha | chronicle.integration.manager_revisions.list_integration_manager_revisions(api_version=APIVersion.V1ALPHA) | secops integration manager-revisions list |
+| integrations.managers.revisions.rollback | v1alpha | chronicle.integration.manager_revisions.rollback_integration_manager_revision(api_version=APIVersion.V1ALPHA) | secops integration manager-revisions rollback |
+| integrations.jobs.revisions.create | v1alpha | chronicle.integration.job_revisions.create_integration_job_revision(api_version=APIVersion.V1ALPHA) | secops integration job-revisions create |
+| integrations.jobs.revisions.delete | v1alpha | chronicle.integration.job_revisions.delete_integration_job_revision(api_version=APIVersion.V1ALPHA) | secops integration job-revisions delete |
+| integrations.jobs.revisions.list | v1alpha | chronicle.integration.job_revisions.list_integration_job_revisions(api_version=APIVersion.V1ALPHA) | secops integration job-revisions list |
+| integrations.jobs.revisions.rollback | v1alpha | chronicle.integration.job_revisions.rollback_integration_job_revision(api_version=APIVersion.V1ALPHA) | secops integration job-revisions rollback |
+| integrations.jobs.jobInstances.create | v1alpha | chronicle.integration.job_instances.create_integration_job_instance(api_version=APIVersion.V1ALPHA) | secops integration job-instances create |
+| integrations.jobs.jobInstances.delete | v1alpha | chronicle.integration.job_instances.delete_integration_job_instance(api_version=APIVersion.V1ALPHA) | secops integration job-instances delete |
+| integrations.jobs.jobInstances.get | v1alpha | chronicle.integration.job_instances.get_integration_job_instance(api_version=APIVersion.V1ALPHA) | secops integration job-instances get |
+| integrations.jobs.jobInstances.list | v1alpha | chronicle.integration.job_instances.list_integration_job_instances(api_version=APIVersion.V1ALPHA) | secops integration job-instances list |
+| integrations.jobs.jobInstances.patch | v1alpha | chronicle.integration.job_instances.update_integration_job_instance(api_version=APIVersion.V1ALPHA) | secops integration job-instances update |
+| integrations.jobs.jobInstances.runOnDemand | v1alpha | chronicle.integration.job_instances.run_integration_job_instance_on_demand(api_version=APIVersion.V1ALPHA) | secops integration job-instances run-on-demand |
+| integrations.jobs.contextProperties.clearAll | v1alpha | chronicle.integration.job_context_properties.delete_all_job_context_properties(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties delete-all |
+| integrations.jobs.contextProperties.create | v1alpha | chronicle.integration.job_context_properties.create_job_context_property(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties create |
+| integrations.jobs.contextProperties.delete | v1alpha | chronicle.integration.job_context_properties.delete_job_context_property(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties delete |
+| integrations.jobs.contextProperties.get | v1alpha | chronicle.integration.job_context_properties.get_job_context_property(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties get |
+| integrations.jobs.contextProperties.list | v1alpha | chronicle.integration.job_context_properties.list_job_context_properties(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties list |
+| integrations.jobs.contextProperties.patch | v1alpha | chronicle.integration.job_context_properties.update_job_context_property(api_version=APIVersion.V1ALPHA) | secops integration job-context-properties update |
+| integrations.jobs.jobInstances.logs.get | v1alpha | chronicle.integration.job_instance_logs.get_job_instance_log(api_version=APIVersion.V1ALPHA) | secops integration job-instance-logs get |
+| integrations.jobs.jobInstances.logs.list | v1alpha | chronicle.integration.job_instance_logs.list_job_instance_logs(api_version=APIVersion.V1ALPHA) | secops integration job-instance-logs list |
+| investigations.fetchAssociated | v1alpha | chronicle.investigations.fetch_associated_investigations | secops investigation fetch-associated |
+| investigations.get | v1alpha | chronicle.investigations.get_investigation | secops investigation get |
+| investigations.list | v1alpha | chronicle.investigations.list_investigations | secops investigation list |
+| investigations.trigger | v1alpha | chronicle.investigations.trigger_investigation | secops investigation trigger |
+| iocs.batchGet | v1alpha | | |
+| iocs.findFirstAndLastSeen | v1alpha | | |
+| iocs.get | v1alpha | | |
+| iocs.getIocState | v1alpha | | |
+| iocs.searchCuratedDetectionsForIoc | v1alpha | | |
+| iocs.updateIocState | v1alpha | | |
+| legacy.legacyBatchGetCases | v1alpha | chronicle.case.get_cases_from_list | secops case |
+| legacy.legacyBatchGetCollections | v1alpha | | |
+| legacy.legacyCreateOrUpdateCase | v1alpha | | |
+| legacy.legacyCreateSoarAlert | v1alpha | | |
+| legacy.legacyFetchAlertsView | v1alpha | chronicle.alert.get_alerts | secops alert |
+| legacy.legacyFetchUdmSearchCsv | v1alpha | chronicle.udm_search.fetch_udm_search_csv | secops search --csv |
+| legacy.legacyFetchUdmSearchView | v1alpha | chronicle.udm_search.fetch_udm_search_view | secops udm-search-view |
+| legacy.legacyFindAssetEvents | v1alpha | | |
+| legacy.legacyFindRawLogs | v1alpha | | |
+| legacy.legacyFindUdmEvents | v1alpha | | |
+| legacy.legacyGetAlert | v1alpha | chronicle.rule_alert.get_alert | |
+| legacy.legacyGetCuratedRulesTrends | v1alpha | | |
+| legacy.legacyGetDetection | v1alpha | | |
+| legacy.legacyGetEventForDetection | v1alpha | | |
+| legacy.legacyGetRuleCounts | v1alpha | | |
+| legacy.legacyGetRulesTrends | v1alpha | | |
+| legacy.legacyListCases | v1alpha | chronicle.case.get_cases | secops case --ids |
+| legacy.legacyRunTestRule | v1alpha | chronicle.rule.run_rule_test | secops rule validate |
+| legacy.legacySearchArtifactEvents | v1alpha | | |
+| legacy.legacySearchArtifactIoCDetails | v1alpha | | |
+| legacy.legacySearchAssetEvents | v1alpha | | |
+| legacy.legacySearchCuratedDetections | v1alpha | | |
+| legacy.legacySearchCustomerStats | v1alpha | | |
+| legacy.legacySearchDetections | v1alpha | chronicle.rule_detection.list_detections | |
+| legacy.legacySearchDomainsRecentlyRegistered | v1alpha | | |
+| legacy.legacySearchDomainsTimingStats | v1alpha | | |
+| legacy.legacySearchEnterpriseWideAlerts | v1alpha | | |
+| legacy.legacySearchEnterpriseWideIoCs | v1alpha | chronicle.ioc.list_iocs | secops iocs |
+| legacy.legacySearchFindings | v1alpha | | |
+| legacy.legacySearchIngestionStats | v1alpha | | |
+| legacy.legacySearchIoCInsights | v1alpha | | |
+| legacy.legacySearchRawLogs | v1alpha | | |
+| legacy.legacySearchRuleDetectionCountBuckets | v1alpha | | |
+| legacy.legacySearchRuleDetectionEvents | v1alpha | | |
+| legacy.legacySearchRuleResults | v1alpha | | |
+| legacy.legacySearchRulesAlerts | v1alpha | chronicle.rule_alert.search_rule_alerts | |
+| legacy.legacySearchUserEvents | v1alpha | | |
+| legacy.legacyStreamDetectionAlerts | v1alpha | | |
+| legacy.legacyTestRuleStreaming | v1alpha | | |
+| legacy.legacyUpdateAlert | v1alpha | chronicle.rule_alert.update_alert | |
+| listAllFindingsRefinementDeployments | v1alpha | | |
+| logProcessingPipelines.associateStreams | v1alpha | chronicle.log_processing_pipelines.associate_streams | secops log-processing associate-streams |
+| logProcessingPipelines.create | v1alpha | chronicle.log_processing_pipelines.create_log_processing_pipeline | secops log-processing create |
+| logProcessingPipelines.delete | v1alpha | chronicle.log_processing_pipelines.delete_log_processing_pipeline | secops log-processing delete |
+| logProcessingPipelines.dissociateStreams | v1alpha | chronicle.log_processing_pipelines.dissociate_streams | secops log-processing dissociate-streams |
+| logProcessingPipelines.fetchAssociatedPipeline | v1alpha | chronicle.log_processing_pipelines.fetch_associated_pipeline | secops log-processing fetch-associated |
+| logProcessingPipelines.fetchSampleLogsByStreams | v1alpha | chronicle.log_processing_pipelines.fetch_sample_logs_by_streams | secops log-processing fetch-sample-logs |
+| logProcessingPipelines.get | v1alpha | chronicle.log_processing_pipelines.get_log_processing_pipeline | secops log-processing get |
+| logProcessingPipelines.list | v1alpha | chronicle.log_processing_pipelines.list_log_processing_pipelines | secops log-processing list |
+| logProcessingPipelines.patch | v1alpha | chronicle.log_processing_pipelines.update_log_processing_pipeline | secops log-processing update |
+| logProcessingPipelines.testPipeline | v1alpha | chronicle.log_processing_pipelines.test_pipeline | secops log-processing test |
+| logTypes.create | v1alpha | | |
+| logTypes.generateEventTypesSuggestions | v1alpha | | |
+| logTypes.get | v1alpha | | |
+| logTypes.getLogTypeSetting | v1alpha | | |
+| logTypes.legacySubmitParserExtension | v1alpha | | |
+| logTypes.list | v1alpha | | |
+| logTypes.logs.export | v1alpha | | |
+| logTypes.logs.get | v1alpha | | |
+| logTypes.logs.import | v1alpha | chronicle.log_ingest.ingest_log | secops log ingest |
+| logTypes.logs.list | v1alpha | | |
+| logTypes.parserExtensions.activate | v1alpha | chronicle.parser_extension.activate_parser_extension | secops parser-extension activate |
+| logTypes.parserExtensions.create | v1alpha | chronicle.parser_extension.create_parser_extension | secops parser-extension create |
+| logTypes.parserExtensions.delete | v1alpha | chronicle.parser_extension.delete_parser_extension | secops parser-extension delete |
+| logTypes.parserExtensions.extensionValidationReports.get | v1alpha | | |
+| logTypes.parserExtensions.extensionValidationReports.list | v1alpha | | |
+| logTypes.parserExtensions.extensionValidationReports.validationErrors.list | v1alpha | | |
+| logTypes.parserExtensions.get | v1alpha | chronicle.parser_extension.get_parser_extension | secops parser-extension get |
+| logTypes.parserExtensions.list | v1alpha | chronicle.parser_extension.list_parser_extensions | secops parser-extension list |
+| logTypes.parserExtensions.validationReports.get | v1alpha | | |
+| logTypes.parserExtensions.validationReports.parsingErrors.list | v1alpha | | |
+| logTypes.parsers.activate | v1alpha | chronicle.parser.activate_parser | secops parser activate |
+| logTypes.parsers.activateReleaseCandidateParser | v1alpha | chronicle.parser.activate_release_candidate | secops parser activate-rc |
+| logTypes.parsers.copy | v1alpha | chronicle.parser.copy_parser | secops parser copy |
+| logTypes.parsers.create | v1alpha | chronicle.parser.create_parser | secops parser create |
+| logTypes.parsers.deactivate | v1alpha | chronicle.parser.deactivate_parser | secops parser deactivate |
+| logTypes.parsers.delete | v1alpha | chronicle.parser.delete_parser | secops parser delete |
+| logTypes.parsers.get | v1alpha | chronicle.parser.get_parser | secops parser get |
+| logTypes.parsers.list | v1alpha | chronicle.parser.list_parsers | secops parser list |
+| logTypes.parsers.validationReports.get | v1alpha | | |
+| logTypes.parsers.validationReports.parsingErrors.list | v1alpha | | |
+| logTypes.patch | v1alpha | | |
+| logTypes.runParser | v1alpha | chronicle.parser.run_parser | secops parser run |
+| logTypes.updateLogTypeSetting | v1alpha | | |
+| logs.classify | v1alpha | chronicle.log_types.classify_logs | secops log classify |
+| marketplaceIntegrations.get | v1alpha | chronicle.marketplace_integrations.get_marketplace_integration(api_version=APIVersion.V1ALPHA) | secops integration marketplace get |
+| marketplaceIntegrations.getDiff | v1alpha | chronicle.marketplace_integrations.get_marketplace_integration_diff(api_version=APIVersion.V1ALPHA) | secops integration marketplace diff |
+| marketplaceIntegrations.install | v1alpha | chronicle.marketplace_integrations.install_marketplace_integration(api_version=APIVersion.V1ALPHA) | secops integration marketplace install |
+| marketplaceIntegrations.list | v1alpha | chronicle.marketplace_integrations.list_marketplace_integrations(api_version=APIVersion.V1ALPHA) | secops integration marketplace list |
+| marketplaceIntegrations.uninstall | v1alpha | chronicle.marketplace_integrations.uninstall_marketplace_integration(api_version=APIVersion.V1ALPHA) | secops integration marketplace uninstall |
+| nativeDashboards.addChart | v1alpha | chronicle.dashboard.add_chart | secops dashboard add-chart |
+| nativeDashboards.create | v1alpha | chronicle.dashboard.create_dashboard | secops dashboard create |
+| nativeDashboards.delete | v1alpha | chronicle.dashboard.delete_dashboard | secops dashboard delete |
+| nativeDashboards.duplicate | v1alpha | chronicle.dashboard.duplicate_dashboard | secops dashboard duplicate |
+| nativeDashboards.duplicateChart | v1alpha | | |
+| nativeDashboards.editChart | v1alpha | chronicle.dashboard.edit_chart | secops dashboard edit-chart |
+| nativeDashboards.export | v1alpha | chronicle.dashboard.export_dashboard | secops dashboard export |
+| nativeDashboards.get | v1alpha | chronicle.dashboard.get_dashboard | secops dashboard get |
+| nativeDashboards.import | v1alpha | chronicle.dashboard.import_dashboard | secops dashboard import |
+| nativeDashboards.list | v1alpha | chronicle.dashboard.list_dashboards | secops dashboard list |
+| nativeDashboards.patch | v1alpha | chronicle.dashboard.update_dashboard | secops dashboard update |
+| nativeDashboards.removeChart | v1alpha | chronicle.dashboard.remove_chart | secops dashboard remove-chart |
+| operations.cancel | v1alpha | | |
+| operations.delete | v1alpha | | |
+| operations.get | v1alpha | | |
+| operations.list | v1alpha | | |
+| operations.streamSearch | v1alpha | | |
+| queryProductSourceStats | v1alpha | | |
+| referenceLists.create | v1alpha | | |
+| referenceLists.get | v1alpha | | |
+| referenceLists.list | v1alpha | | |
+| referenceLists.patch | v1alpha | | |
+| report | v1alpha | | |
+| ruleExecutionErrors.list | v1alpha | chronicle.rule_detection.list_errors | |
+| rules.create | v1alpha | | |
+| rules.delete | v1alpha | | |
+| rules.deployments.list | v1alpha | | |
+| rules.get | v1alpha | | |
+| rules.getDeployment | v1alpha | | |
+| rules.list | v1alpha | | |
+| rules.listRevisions | v1alpha | | |
+| rules.patch | v1alpha | | |
+| rules.retrohunts.create | v1alpha | | |
+| rules.retrohunts.get | v1alpha | | |
+| rules.retrohunts.list | v1alpha | | |
+| rules.updateDeployment | v1alpha | | |
+| searchEntities | v1alpha | | |
+| searchRawLogs | v1alpha | | |
+| summarizeEntitiesFromQuery | v1alpha | chronicle.entity.summarize_entity | secops entity |
+| summarizeEntity | v1alpha | chronicle.entity.summarize_entity | |
+| testFindingsRefinement | v1alpha | | |
+| translateUdmQuery | v1alpha | chronicle.nl_search.translate_nl_to_udm | |
+| translateYlRule | v1alpha | | |
+| udmSearch | v1alpha | chronicle.search.search_udm | secops search |
+| undelete | v1alpha | | |
+| updateBigQueryExport | v1alpha | | |
+| updateRiskConfig | v1alpha | | |
+| users.clearConversationHistory | v1alpha | | |
+| users.conversations.create | v1alpha | chronicle.gemini.create_conversation | |
+| users.conversations.delete | v1alpha | | |
+| users.conversations.get | v1alpha | | |
+| users.conversations.list | v1alpha | | |
+| users.conversations.messages.create | v1alpha | chronicle.gemini.query_gemini | secops gemini |
+| users.conversations.messages.delete | v1alpha | | |
+| users.conversations.messages.get | v1alpha | | |
+| users.conversations.messages.list | v1alpha | | |
+| users.conversations.messages.patch | v1alpha | | |
+| users.conversations.patch | v1alpha | | |
+| users.getPreferenceSet | v1alpha | chronicle.gemini.opt_in_to_gemini | secops gemini --opt-in |
+| users.searchQueries.create | v1alpha | | |
+| users.searchQueries.delete | v1alpha | | |
+| users.searchQueries.get | v1alpha | | |
+| users.searchQueries.list | v1alpha | | |
+| users.searchQueries.patch | v1alpha | | |
+| users.updatePreferenceSet | v1alpha | | |
+| validateQuery | v1alpha | chronicle.validate.validate_query | |
+| verifyReferenceList | v1alpha | | |
+| verifyRuleText | v1alpha | chronicle.rule_validation.validate_rule | secops rule validate |
+| watchlists.create | v1alpha | | |
+| watchlists.delete | v1alpha | | |
+| watchlists.entities.add | v1alpha | | |
+| watchlists.entities.batchAdd | v1alpha | | |
+| watchlists.entities.batchRemove | v1alpha | | |
+| watchlists.entities.remove | v1alpha | | |
+| watchlists.get | v1alpha | | |
+| watchlists.list | v1alpha | | |
+| watchlists.listEntities | v1alpha | | |
+| watchlists.patch | v1alpha | | |
| REST Resource | Version | secops-wrapper module | CLI Command |
|--------------------------------------------------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------|
| dataAccessLabels.create | v1 | | |
diff --git a/src/secops/chronicle/__init__.py b/src/secops/chronicle/__init__.py
index 15320ac9..51a4cd4d 100644
--- a/src/secops/chronicle/__init__.py
+++ b/src/secops/chronicle/__init__.py
@@ -98,27 +98,43 @@
search_log_types,
)
from secops.chronicle.models import (
+ AdvancedConfig,
AlertCount,
AlertState,
Case,
CaseList,
+ DailyScheduleDetails,
DataExport,
DataExportStage,
DataExportStatus,
+ Date,
+ DayOfWeek,
DetectionType,
+ DiffType,
Entity,
EntityMetadata,
EntityMetrics,
EntitySummary,
FileMetadataAndProperties,
InputInterval,
+ IntegrationJobInstanceParameter,
+ IntegrationParam,
+ IntegrationParamType,
+ IntegrationType,
ListBasis,
+ MonthlyScheduleDetails,
+ OneTimeScheduleDetails,
PrevalenceData,
+ PythonVersion,
+ ScheduleType,
SoarPlatformInfo,
+ TargetMode,
TileType,
TimeInterval,
Timeline,
TimelineBucket,
+ TimeOfDay,
+ WeeklyScheduleDetails,
WidgetMetadata,
)
from secops.chronicle.nl_search import translate_nl_to_udm
@@ -198,6 +214,36 @@
create_watchlist,
update_watchlist,
)
+from secops.chronicle.integration.transformers import (
+ list_integration_transformers,
+ get_integration_transformer,
+ delete_integration_transformer,
+ create_integration_transformer,
+ update_integration_transformer,
+ execute_integration_transformer_test,
+ get_integration_transformer_template,
+)
+from secops.chronicle.integration.transformer_revisions import (
+ list_integration_transformer_revisions,
+ delete_integration_transformer_revision,
+ create_integration_transformer_revision,
+ rollback_integration_transformer_revision,
+)
+from secops.chronicle.integration.logical_operators import (
+ list_integration_logical_operators,
+ get_integration_logical_operator,
+ delete_integration_logical_operator,
+ create_integration_logical_operator,
+ update_integration_logical_operator,
+ execute_integration_logical_operator_test,
+ get_integration_logical_operator_template,
+)
+from secops.chronicle.integration.logical_operator_revisions import (
+ list_integration_logical_operator_revisions,
+ delete_integration_logical_operator_revision,
+ create_integration_logical_operator_revision,
+ rollback_integration_logical_operator_revision,
+)
__all__ = [
# Client
@@ -315,21 +361,31 @@
"execute_query",
"get_execute_query",
# Models
+ "AdvancedConfig",
+ "AlertCount",
+ "AlertState",
+ "Case",
+ "CaseList",
+ "DailyScheduleDetails",
+ "Date",
+ "DayOfWeek",
"Entity",
"EntityMetadata",
"EntityMetrics",
+ "EntitySummary",
+ "FileMetadataAndProperties",
+ "IntegrationJobInstanceParameter",
+ "MonthlyScheduleDetails",
+ "OneTimeScheduleDetails",
+ "PrevalenceData",
+ "ScheduleType",
+ "SoarPlatformInfo",
"TimeInterval",
- "TimelineBucket",
"Timeline",
+ "TimelineBucket",
+ "TimeOfDay",
+ "WeeklyScheduleDetails",
"WidgetMetadata",
- "EntitySummary",
- "AlertCount",
- "AlertState",
- "Case",
- "SoarPlatformInfo",
- "CaseList",
- "PrevalenceData",
- "FileMetadataAndProperties",
"ValidationResult",
"GeminiResponse",
"Block",
@@ -367,4 +423,30 @@
"delete_watchlist",
"create_watchlist",
"update_watchlist",
+ # Integration Transformers
+ "list_integration_transformers",
+ "get_integration_transformer",
+ "delete_integration_transformer",
+ "create_integration_transformer",
+ "update_integration_transformer",
+ "execute_integration_transformer_test",
+ "get_integration_transformer_template",
+ # Integration Transformer Revisions
+ "list_integration_transformer_revisions",
+ "delete_integration_transformer_revision",
+ "create_integration_transformer_revision",
+ "rollback_integration_transformer_revision",
+ # Integration Logical Operators
+ "list_integration_logical_operators",
+ "get_integration_logical_operator",
+ "delete_integration_logical_operator",
+ "create_integration_logical_operator",
+ "update_integration_logical_operator",
+ "execute_integration_logical_operator_test",
+ "get_integration_logical_operator_template",
+ # Integration Logical Operator Revisions
+ "list_integration_logical_operator_revisions",
+ "delete_integration_logical_operator_revision",
+ "create_integration_logical_operator_revision",
+ "rollback_integration_logical_operator_revision",
]
diff --git a/src/secops/chronicle/client.py b/src/secops/chronicle/client.py
index 9b892272..4f5177e0 100644
--- a/src/secops/chronicle/client.py
+++ b/src/secops/chronicle/client.py
@@ -13,6 +13,7 @@
# limitations under the License.
#
"""Chronicle API client."""
+
import ipaddress
import re
from collections.abc import Iterator
@@ -22,140 +23,142 @@
from google.auth.transport import requests as google_auth_requests
+# pylint: disable=line-too-long
from secops import auth as secops_auth
from secops.auth import RetryConfig
from secops.chronicle.alert import get_alerts as _get_alerts
from secops.chronicle.case import get_cases_from_list
-from secops.chronicle.dashboard import DashboardAccessType, DashboardView
-from secops.chronicle.dashboard import add_chart as _add_chart
-from secops.chronicle.dashboard import create_dashboard as _create_dashboard
-from secops.chronicle.dashboard import delete_dashboard as _delete_dashboard
from secops.chronicle.dashboard import (
+ DashboardAccessType,
+ DashboardView,
+ add_chart as _add_chart,
+ create_dashboard as _create_dashboard,
+ delete_dashboard as _delete_dashboard,
duplicate_dashboard as _duplicate_dashboard,
+ edit_chart as _edit_chart,
+ export_dashboard as _export_dashboard,
+ get_chart as _get_chart,
+ get_dashboard as _get_dashboard,
+ import_dashboard as _import_dashboard,
+ list_dashboards as _list_dashboards,
+ remove_chart as _remove_chart,
+ update_dashboard as _update_dashboard,
)
-from secops.chronicle.dashboard import edit_chart as _edit_chart
-from secops.chronicle.dashboard import export_dashboard as _export_dashboard
-from secops.chronicle.dashboard import get_chart as _get_chart
-from secops.chronicle.dashboard import get_dashboard as _get_dashboard
-from secops.chronicle.dashboard import import_dashboard as _import_dashboard
-from secops.chronicle.dashboard import list_dashboards as _list_dashboards
-from secops.chronicle.dashboard import remove_chart as _remove_chart
-from secops.chronicle.dashboard import update_dashboard as _update_dashboard
from secops.chronicle.dashboard_query import (
execute_query as _execute_dashboard_query,
-)
-from secops.chronicle.dashboard_query import (
get_execute_query as _get_execute_query,
)
from secops.chronicle.data_export import (
cancel_data_export as _cancel_data_export,
-)
-from secops.chronicle.data_export import (
create_data_export as _create_data_export,
-)
-from secops.chronicle.data_export import (
fetch_available_log_types as _fetch_available_log_types,
-)
-from secops.chronicle.data_export import get_data_export as _get_data_export
-from secops.chronicle.data_export import list_data_export as _list_data_export
-from secops.chronicle.data_export import (
+ get_data_export as _get_data_export,
+ list_data_export as _list_data_export,
update_data_export as _update_data_export,
)
-from secops.chronicle.data_table import DataTableColumnType
-from secops.chronicle.data_table import create_data_table as _create_data_table
from secops.chronicle.data_table import (
+ DataTableColumnType,
+ create_data_table as _create_data_table,
create_data_table_rows as _create_data_table_rows,
-)
-from secops.chronicle.data_table import delete_data_table as _delete_data_table
-from secops.chronicle.data_table import (
+ delete_data_table as _delete_data_table,
delete_data_table_rows as _delete_data_table_rows,
-)
-from secops.chronicle.data_table import get_data_table as _get_data_table
-from secops.chronicle.data_table import (
+ get_data_table as _get_data_table,
list_data_table_rows as _list_data_table_rows,
-)
-from secops.chronicle.data_table import list_data_tables as _list_data_tables
-from secops.chronicle.data_table import (
+ list_data_tables as _list_data_tables,
replace_data_table_rows as _replace_data_table_rows,
-)
-from secops.chronicle.data_table import update_data_table as _update_data_table
-from secops.chronicle.data_table import (
+ update_data_table as _update_data_table,
update_data_table_rows as _update_data_table_rows,
)
-from secops.chronicle.entity import _detect_value_type_for_query
-from secops.chronicle.entity import summarize_entity as _summarize_entity
-from secops.chronicle.feeds import CreateFeedModel, UpdateFeedModel
-from secops.chronicle.feeds import create_feed as _create_feed
-from secops.chronicle.feeds import delete_feed as _delete_feed
-from secops.chronicle.feeds import disable_feed as _disable_feed
-from secops.chronicle.feeds import enable_feed as _enable_feed
-from secops.chronicle.feeds import generate_secret as _generate_secret
-from secops.chronicle.feeds import get_feed as _get_feed
-from secops.chronicle.feeds import list_feeds as _list_feeds
-from secops.chronicle.feeds import update_feed as _update_feed
-from secops.chronicle.gemini import GeminiResponse
-from secops.chronicle.gemini import opt_in_to_gemini as _opt_in_to_gemini
-from secops.chronicle.gemini import query_gemini as _query_gemini
-from secops.chronicle.ioc import list_iocs as _list_iocs
-from secops.chronicle.investigations import (
- fetch_associated_investigations as _fetch_associated_investigations,
+from secops.chronicle.entity import (
+ _detect_value_type_for_query,
+ summarize_entity as _summarize_entity,
)
-from secops.chronicle.investigations import (
- get_investigation as _get_investigation,
+from secops.chronicle.featured_content_rules import (
+ list_featured_content_rules as _list_featured_content_rules,
)
-from secops.chronicle.investigations import (
- list_investigations as _list_investigations,
+from secops.chronicle.feeds import (
+ CreateFeedModel,
+ UpdateFeedModel,
+ create_feed as _create_feed,
+ delete_feed as _delete_feed,
+ disable_feed as _disable_feed,
+ enable_feed as _enable_feed,
+ generate_secret as _generate_secret,
+ get_feed as _get_feed,
+ list_feeds as _list_feeds,
+ update_feed as _update_feed,
+)
+from secops.chronicle.gemini import (
+ GeminiResponse,
+ opt_in_to_gemini as _opt_in_to_gemini,
+ query_gemini as _query_gemini,
)
from secops.chronicle.investigations import (
+ fetch_associated_investigations as _fetch_associated_investigations,
+ get_investigation as _get_investigation,
+ list_investigations as _list_investigations,
trigger_investigation as _trigger_investigation,
)
-from secops.chronicle.log_ingest import create_forwarder as _create_forwarder
-from secops.chronicle.log_ingest import delete_forwarder as _delete_forwarder
-from secops.chronicle.log_ingest import get_forwarder as _get_forwarder
+from secops.chronicle.ioc import list_iocs as _list_iocs
from secops.chronicle.log_ingest import (
+ create_forwarder as _create_forwarder,
+ delete_forwarder as _delete_forwarder,
+ get_forwarder as _get_forwarder,
get_or_create_forwarder as _get_or_create_forwarder,
+ import_entities as _import_entities,
+ ingest_log as _ingest_log,
+ ingest_udm as _ingest_udm,
+ list_forwarders as _list_forwarders,
+ update_forwarder as _update_forwarder,
)
-from secops.chronicle.log_ingest import import_entities as _import_entities
-from secops.chronicle.log_ingest import ingest_log as _ingest_log
-from secops.chronicle.log_ingest import ingest_udm as _ingest_udm
-from secops.chronicle.log_ingest import list_forwarders as _list_forwarders
-from secops.chronicle.log_ingest import update_forwarder as _update_forwarder
-from secops.chronicle.log_types import classify_logs as _classify_logs
-from secops.chronicle.log_types import get_all_log_types as _get_all_log_types
-from secops.chronicle.log_types import (
- get_log_type_description as _get_log_type_description,
-)
-from secops.chronicle.log_types import is_valid_log_type as _is_valid_log_type
-from secops.chronicle.log_types import search_log_types as _search_log_types
from secops.chronicle.log_processing_pipelines import (
associate_streams as _associate_streams,
-)
-from secops.chronicle.log_processing_pipelines import (
create_log_processing_pipeline as _create_log_processing_pipeline,
-)
-from secops.chronicle.log_processing_pipelines import (
delete_log_processing_pipeline as _delete_log_processing_pipeline,
-)
-from secops.chronicle.log_processing_pipelines import (
dissociate_streams as _dissociate_streams,
-)
-from secops.chronicle.log_processing_pipelines import (
fetch_associated_pipeline as _fetch_associated_pipeline,
-)
-from secops.chronicle.log_processing_pipelines import (
fetch_sample_logs_by_streams as _fetch_sample_logs_by_streams,
-)
-from secops.chronicle.log_processing_pipelines import (
get_log_processing_pipeline as _get_log_processing_pipeline,
-)
-from secops.chronicle.log_processing_pipelines import (
list_log_processing_pipelines as _list_log_processing_pipelines,
-)
-from secops.chronicle.log_processing_pipelines import (
+ test_pipeline as _test_pipeline,
update_log_processing_pipeline as _update_log_processing_pipeline,
)
-from secops.chronicle.log_processing_pipelines import (
- test_pipeline as _test_pipeline,
+from secops.chronicle.log_types import (
+ classify_logs as _classify_logs,
+ get_all_log_types as _get_all_log_types,
+ get_log_type_description as _get_log_type_description,
+ is_valid_log_type as _is_valid_log_type,
+ search_log_types as _search_log_types,
+)
+from secops.chronicle.integration.transformers import (
+ create_integration_transformer as _create_integration_transformer,
+ delete_integration_transformer as _delete_integration_transformer,
+ execute_integration_transformer_test as _execute_integration_transformer_test,
+ get_integration_transformer as _get_integration_transformer,
+ get_integration_transformer_template as _get_integration_transformer_template,
+ list_integration_transformers as _list_integration_transformers,
+ update_integration_transformer as _update_integration_transformer,
+)
+from secops.chronicle.integration.transformer_revisions import (
+ create_integration_transformer_revision as _create_integration_transformer_revision,
+ delete_integration_transformer_revision as _delete_integration_transformer_revision,
+ list_integration_transformer_revisions as _list_integration_transformer_revisions,
+ rollback_integration_transformer_revision as _rollback_integration_transformer_revision,
+)
+from secops.chronicle.integration.logical_operators import (
+ create_integration_logical_operator as _create_integration_logical_operator,
+ delete_integration_logical_operator as _delete_integration_logical_operator,
+ execute_integration_logical_operator_test as _execute_integration_logical_operator_test,
+ get_integration_logical_operator as _get_integration_logical_operator,
+ get_integration_logical_operator_template as _get_integration_logical_operator_template,
+ list_integration_logical_operators as _list_integration_logical_operators,
+ update_integration_logical_operator as _update_integration_logical_operator,
+)
+from secops.chronicle.integration.logical_operator_revisions import (
+ create_integration_logical_operator_revision as _create_integration_logical_operator_revision,
+ delete_integration_logical_operator_revision as _delete_integration_logical_operator_revision,
+ list_integration_logical_operator_revisions as _list_integration_logical_operator_revisions,
+ rollback_integration_logical_operator_revision as _rollback_integration_logical_operator_revision,
)
from secops.chronicle.models import (
APIVersion,
@@ -166,102 +169,70 @@
InputInterval,
TileType,
)
-from secops.chronicle.nl_search import nl_search as _nl_search
-from secops.chronicle.nl_search import translate_nl_to_udm
-from secops.chronicle.parser import activate_parser as _activate_parser
+from secops.chronicle.nl_search import (
+ nl_search as _nl_search,
+ translate_nl_to_udm,
+)
from secops.chronicle.parser import (
+ activate_parser as _activate_parser,
activate_release_candidate_parser as _activate_release_candidate_parser,
+ copy_parser as _copy_parser,
+ create_parser as _create_parser,
+ deactivate_parser as _deactivate_parser,
+ delete_parser as _delete_parser,
+ get_parser as _get_parser,
+ list_parsers as _list_parsers,
+ run_parser as _run_parser,
)
-from secops.chronicle.parser import copy_parser as _copy_parser
-from secops.chronicle.parser import create_parser as _create_parser
-from secops.chronicle.parser import deactivate_parser as _deactivate_parser
-from secops.chronicle.parser import delete_parser as _delete_parser
-from secops.chronicle.parser import get_parser as _get_parser
-from secops.chronicle.parser import list_parsers as _list_parsers
-from secops.chronicle.parser import run_parser as _run_parser
-from secops.chronicle.parser_extension import ParserExtensionConfig
from secops.chronicle.parser_extension import (
+ ParserExtensionConfig,
activate_parser_extension as _activate_parser_extension,
-)
-from secops.chronicle.parser_extension import (
create_parser_extension as _create_parser_extension,
-)
-from secops.chronicle.parser_extension import (
delete_parser_extension as _delete_parser_extension,
-)
-from secops.chronicle.parser_extension import (
get_parser_extension as _get_parser_extension,
-)
-from secops.chronicle.parser_extension import (
list_parser_extensions as _list_parser_extensions,
)
from secops.chronicle.reference_list import (
ReferenceListSyntaxType,
ReferenceListView,
-)
-from secops.chronicle.reference_list import (
create_reference_list as _create_reference_list,
-)
-from secops.chronicle.reference_list import (
get_reference_list as _get_reference_list,
-)
-from secops.chronicle.reference_list import (
list_reference_lists as _list_reference_lists,
-)
-from secops.chronicle.reference_list import (
update_reference_list as _update_reference_list,
)
-
-# Import rule functions
-from secops.chronicle.rule import create_rule as _create_rule
-from secops.chronicle.rule import delete_rule as _delete_rule
-from secops.chronicle.rule import enable_rule as _enable_rule
-from secops.chronicle.rule import get_rule as _get_rule
-from secops.chronicle.rule import get_rule_deployment as _get_rule_deployment
from secops.chronicle.rule import (
+ create_rule as _create_rule,
+ delete_rule as _delete_rule,
+ enable_rule as _enable_rule,
+ get_rule as _get_rule,
+ get_rule_deployment as _get_rule_deployment,
list_rule_deployments as _list_rule_deployments,
-)
-from secops.chronicle.rule import list_rules as _list_rules
-from secops.chronicle.rule import run_rule_test
-from secops.chronicle.rule import search_rules as _search_rules
-from secops.chronicle.rule import set_rule_alerting as _set_rule_alerting
-from secops.chronicle.rule import update_rule as _update_rule
-from secops.chronicle.rule import (
+ list_rules as _list_rules,
+ run_rule_test,
+ search_rules as _search_rules,
+ set_rule_alerting as _set_rule_alerting,
+ update_rule as _update_rule,
update_rule_deployment as _update_rule_deployment,
)
from secops.chronicle.rule_alert import (
bulk_update_alerts as _bulk_update_alerts,
-)
-from secops.chronicle.rule_alert import get_alert as _get_alert
-from secops.chronicle.rule_alert import (
+ get_alert as _get_alert,
search_rule_alerts as _search_rule_alerts,
+ update_alert as _update_alert,
+)
+from secops.chronicle.rule_detection import (
+ list_detections as _list_detections,
+ list_errors as _list_errors,
)
-from secops.chronicle.rule_alert import update_alert as _update_alert
-from secops.chronicle.rule_detection import list_detections as _list_detections
-from secops.chronicle.rule_detection import list_errors as _list_errors
from secops.chronicle.rule_exclusion import (
RuleExclusionType,
UpdateRuleDeployment,
-)
-from secops.chronicle.rule_exclusion import (
compute_rule_exclusion_activity as _compute_rule_exclusion_activity,
-)
-from secops.chronicle.rule_exclusion import (
create_rule_exclusion as _create_rule_exclusion,
-)
-from secops.chronicle.rule_exclusion import (
get_rule_exclusion as _get_rule_exclusion,
-)
-from secops.chronicle.rule_exclusion import (
get_rule_exclusion_deployment as _get_rule_exclusion_deployment,
-)
-from secops.chronicle.rule_exclusion import (
list_rule_exclusions as _list_rule_exclusions,
-)
-from secops.chronicle.rule_exclusion import (
patch_rule_exclusion as _patch_rule_exclusion,
-)
-from secops.chronicle.rule_exclusion import (
update_rule_exclusion_deployment as _update_rule_exclusion_deployment,
)
from secops.chronicle.rule_retrohunt import (
@@ -270,72 +241,45 @@
list_retrohunts as _list_retrohunts,
)
from secops.chronicle.rule_set import (
- batch_update_curated_rule_set_deployments as _batch_update_curated_rule_set_deployments, # pylint: disable=line-too-long
-)
-from secops.chronicle.rule_set import get_curated_rule as _get_curated_rule
-from secops.chronicle.rule_set import (
+ batch_update_curated_rule_set_deployments as _batch_update_curated_rule_set_deployments,
+ get_curated_rule as _get_curated_rule,
get_curated_rule_by_name as _get_curated_rule_by_name,
-)
-from secops.chronicle.rule_set import (
get_curated_rule_set as _get_curated_rule_set,
-)
-from secops.chronicle.rule_set import (
get_curated_rule_set_category as _get_curated_rule_set_category,
-)
-from secops.chronicle.rule_set import (
get_curated_rule_set_deployment as _get_curated_rule_set_deployment,
-)
-from secops.chronicle.rule_set import (
- get_curated_rule_set_deployment_by_name as _get_curated_rule_set_deployment_by_name, # pylint: disable=line-too-long
-)
-from secops.chronicle.rule_set import (
+ get_curated_rule_set_deployment_by_name as _get_curated_rule_set_deployment_by_name,
list_curated_rule_set_categories as _list_curated_rule_set_categories,
-)
-from secops.chronicle.rule_set import (
list_curated_rule_set_deployments as _list_curated_rule_set_deployments,
-)
-from secops.chronicle.rule_set import (
list_curated_rule_sets as _list_curated_rule_sets,
-)
-from secops.chronicle.rule_set import list_curated_rules as _list_curated_rules
-from secops.chronicle.rule_set import (
+ list_curated_rules as _list_curated_rules,
search_curated_detections as _search_curated_detections,
-)
-from secops.chronicle.rule_set import (
update_curated_rule_set_deployment as _update_curated_rule_set_deployment,
)
-from secops.chronicle.featured_content_rules import (
- list_featured_content_rules as _list_featured_content_rules,
-)
from secops.chronicle.rule_validation import validate_rule as _validate_rule
from secops.chronicle.search import search_udm as _search_udm
from secops.chronicle.log_search import search_raw_logs as _search_raw_logs
from secops.chronicle.stats import get_stats as _get_stats
-from secops.chronicle.udm_mapping import RowLogFormat
from secops.chronicle.udm_mapping import (
+ RowLogFormat,
generate_udm_key_value_mappings as _generate_udm_key_value_mappings,
)
-
-# Import functions from the new modules
from secops.chronicle.udm_search import (
fetch_udm_search_csv as _fetch_udm_search_csv,
-)
-from secops.chronicle.udm_search import (
fetch_udm_search_view as _fetch_udm_search_view,
-)
-from secops.chronicle.udm_search import (
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,
+ delete_watchlist as _delete_watchlist,
+ get_watchlist as _get_watchlist,
+ list_watchlists as _list_watchlists,
update_watchlist as _update_watchlist,
)
from secops.exceptions import SecOpsError
+# pylint: enable=line-too-long
+
class ValueType(Enum):
"""Chronicle API value types."""
@@ -761,6 +705,944 @@ def update_watchlist(
update_mask,
)
+ # -- Integration Transformers methods --
+
+ def list_integration_transformers(
+ self,
+ integration_name: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ exclude_staging: bool | None = None,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all transformer definitions for a specific integration.
+
+ Use this method to browse the available transformers.
+
+ Args:
+ integration_name: Name of the integration to list transformers
+ for.
+ page_size: Maximum number of transformers to return. Defaults
+ to 100, maximum is 200.
+ page_token: Page token from a previous call to retrieve the
+ next page.
+ filter_string: Filter expression to filter transformers.
+ order_by: Field to sort the transformers by.
+ exclude_staging: Whether to exclude staging transformers from
+ the response. By default, staging transformers are included.
+ expand: Expand the response with the full transformer details.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ If as_list is True: List of transformers.
+ If as_list is False: Dict with transformers list and
+ nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _list_integration_transformers(
+ self,
+ integration_name,
+ page_size=page_size,
+ page_token=page_token,
+ filter_string=filter_string,
+ order_by=order_by,
+ exclude_staging=exclude_staging,
+ expand=expand,
+ api_version=api_version,
+ )
+
+ def get_integration_transformer(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Get a single transformer definition for a specific integration.
+
+ Use this method to retrieve the Python script, input parameters,
+ and expected input, output and usage example schema for a specific
+ data transformation logic within an integration.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to retrieve.
+ expand: Expand the response with the full transformer details.
+ Optional.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing details of the specified TransformerDefinition.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _get_integration_transformer(
+ self,
+ integration_name,
+ transformer_id,
+ expand=expand,
+ api_version=api_version,
+ )
+
+ def delete_integration_transformer(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> None:
+ """Delete a custom transformer definition from a given integration.
+
+ Use this method to permanently remove an obsolete transformer from
+ an integration.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to delete.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _delete_integration_transformer(
+ self,
+ integration_name,
+ transformer_id,
+ api_version=api_version,
+ )
+
+ def create_integration_transformer(
+ self,
+ integration_name: str,
+ display_name: str,
+ script: str,
+ script_timeout: str,
+ enabled: bool,
+ description: str | None = None,
+ parameters: list[dict[str, Any]] | None = None,
+ usage_example: str | None = None,
+ expected_output: str | None = None,
+ expected_input: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Create a new transformer definition for a given integration.
+
+ Use this method to define a transformer, specifying its functional
+ Python script and necessary input parameters.
+
+ Args:
+ integration_name: Name of the integration to create the
+ transformer for.
+ display_name: Transformer's display name. Maximum 150 characters.
+ Required.
+ script: Transformer's Python script. Required.
+ script_timeout: Timeout in seconds for a single script run.
+ Default is 60. Required.
+ enabled: Whether the transformer is enabled or disabled.
+ Required.
+ description: Transformer's description. Maximum 2050 characters.
+ Optional.
+ parameters: List of transformer parameter dicts. Optional.
+ usage_example: Transformer's usage example. Optional.
+ expected_output: Transformer's expected output. Optional.
+ expected_input: Transformer's expected input. Optional.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the newly created TransformerDefinition
+ resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _create_integration_transformer(
+ self,
+ integration_name,
+ display_name,
+ script,
+ script_timeout,
+ enabled,
+ description=description,
+ parameters=parameters,
+ usage_example=usage_example,
+ expected_output=expected_output,
+ expected_input=expected_input,
+ api_version=api_version,
+ )
+
+ def update_integration_transformer(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ display_name: str | None = None,
+ script: str | None = None,
+ script_timeout: str | None = None,
+ enabled: bool | None = None,
+ description: str | None = None,
+ parameters: list[dict[str, Any]] | None = None,
+ usage_example: str | None = None,
+ expected_output: str | None = None,
+ expected_input: str | None = None,
+ update_mask: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Update an existing transformer definition for a given
+ integration.
+
+ Use this method to modify a transformation's Python script, adjust
+ its description, or refine its parameter definitions.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to update.
+ display_name: Transformer's display name. Maximum 150
+ characters.
+ script: Transformer's Python script.
+ script_timeout: Timeout in seconds for a single script run.
+ enabled: Whether the transformer is enabled or disabled.
+ description: Transformer's description. Maximum 2050 characters.
+ parameters: List of transformer parameter dicts. When updating
+ existing parameters, id must be provided in each parameter.
+ usage_example: Transformer's usage example.
+ expected_output: Transformer's expected output.
+ expected_input: Transformer's expected input.
+ update_mask: Comma-separated list of fields to update. If
+ omitted, the mask is auto-generated from whichever fields
+ are provided. Example: "displayName,script".
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the updated TransformerDefinition resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _update_integration_transformer(
+ self,
+ integration_name,
+ transformer_id,
+ display_name=display_name,
+ script=script,
+ script_timeout=script_timeout,
+ enabled=enabled,
+ description=description,
+ parameters=parameters,
+ usage_example=usage_example,
+ expected_output=expected_output,
+ expected_input=expected_input,
+ update_mask=update_mask,
+ api_version=api_version,
+ )
+
+ def execute_integration_transformer_test(
+ self,
+ integration_name: str,
+ transformer: dict[str, Any],
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Execute a test run of a transformer's Python script.
+
+ Use this method to verify transformation logic and ensure data is
+ being parsed and formatted correctly before saving or deploying
+ the transformer. The full transformer object is required as the
+ test can be run without saving the transformer first.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer: Dict containing the TransformerDefinition to test.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the test execution results with the following
+ fields:
+ - outputMessage: Human-readable output message set by the
+ script.
+ - debugOutputMessage: The script debug output.
+ - resultValue: The script result value.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _execute_integration_transformer_test(
+ self,
+ integration_name,
+ transformer,
+ api_version=api_version,
+ )
+
+ def get_integration_transformer_template(
+ self,
+ integration_name: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Retrieve a default Python script template for a new transformer.
+
+ Use this method to jumpstart the development of a custom data
+ transformation logic by providing boilerplate code.
+
+ Args:
+ integration_name: Name of the integration to fetch the template
+ for.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the TransformerDefinition template.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _get_integration_transformer_template(
+ self,
+ integration_name,
+ api_version=api_version,
+ )
+
+ # -- Integration Transformer Revisions methods --
+
+ def list_integration_transformer_revisions(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+ ) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all revisions for a specific transformer.
+
+ Use this method to view the revision history of a transformer,
+ enabling you to track changes and potentially rollback to previous
+ versions.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to list revisions for.
+ page_size: Maximum number of revisions to return. Defaults to
+ 100, maximum is 200.
+ page_token: Page token from a previous call to retrieve the
+ next page.
+ filter_string: Filter expression to filter revisions.
+ order_by: Field to sort the revisions by.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+ as_list: If True, automatically fetches all pages and returns
+ a list of revisions. If False, returns dict with revisions
+ and nextPageToken.
+
+ Returns:
+ If as_list is True: List of transformer revisions.
+ If as_list is False: Dict with revisions list and nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _list_integration_transformer_revisions(
+ self,
+ integration_name,
+ transformer_id,
+ page_size=page_size,
+ page_token=page_token,
+ filter_string=filter_string,
+ order_by=order_by,
+ api_version=api_version,
+ as_list=as_list,
+ )
+
+ def delete_integration_transformer_revision(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> None:
+ """Delete a specific transformer revision.
+
+ Use this method to remove obsolete or incorrect revisions from
+ a transformer's history.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer.
+ revision_id: ID of the revision to delete.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _delete_integration_transformer_revision(
+ self,
+ integration_name,
+ transformer_id,
+ revision_id,
+ api_version=api_version,
+ )
+
+ def create_integration_transformer_revision(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ transformer: dict[str, Any],
+ comment: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Create a new revision for a transformer.
+
+ Use this method to create a snapshot of the transformer's current
+ state before making changes, enabling you to rollback if needed.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to create a revision for.
+ transformer: Dict containing the TransformerDefinition to save
+ as a revision.
+ comment: Optional comment describing the revision or changes.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the newly created TransformerRevision resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _create_integration_transformer_revision(
+ self,
+ integration_name,
+ transformer_id,
+ transformer,
+ comment=comment,
+ api_version=api_version,
+ )
+
+ def rollback_integration_transformer_revision(
+ self,
+ integration_name: str,
+ transformer_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Rollback a transformer to a previous revision.
+
+ Use this method to restore a transformer to a previous working
+ state by rolling back to a specific revision.
+
+ Args:
+ integration_name: Name of the integration the transformer
+ belongs to.
+ transformer_id: ID of the transformer to rollback.
+ revision_id: ID of the revision to rollback to.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the updated TransformerDefinition resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _rollback_integration_transformer_revision(
+ self,
+ integration_name,
+ transformer_id,
+ revision_id,
+ api_version=api_version,
+ )
+
+ # -- Integration Logical Operators methods --
+
+ def list_integration_logical_operators(
+ self,
+ integration_name: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ exclude_staging: bool | None = None,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+ ) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all logical operator definitions for a specific integration.
+
+ Use this method to browse the available logical operators that can
+ be used for conditional logic in your integration workflows.
+
+ Args:
+ integration_name: Name of the integration to list logical
+ operators for.
+ page_size: Maximum number of logical operators to return.
+ Defaults to 100, maximum is 200.
+ page_token: Page token from a previous call to retrieve the
+ next page.
+ filter_string: Filter expression to filter logical operators.
+ order_by: Field to sort the logical operators by.
+ exclude_staging: Whether to exclude staging logical operators
+ from the response. By default, staging operators are included.
+ expand: Expand the response with the full logical operator
+ details.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+ as_list: If True, automatically fetches all pages and returns
+ a list. If False, returns dict with list and nextPageToken.
+
+ Returns:
+ If as_list is True: List of logical operators.
+ If as_list is False: Dict with logicalOperators list and
+ nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _list_integration_logical_operators(
+ self,
+ integration_name,
+ page_size=page_size,
+ page_token=page_token,
+ filter_string=filter_string,
+ order_by=order_by,
+ exclude_staging=exclude_staging,
+ expand=expand,
+ api_version=api_version,
+ as_list=as_list,
+ )
+
+ def get_integration_logical_operator(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Get a single logical operator definition for a specific integration.
+
+ Use this method to retrieve the Python script, input parameters,
+ and evaluation logic for a specific logical operator within an
+ integration.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to retrieve.
+ expand: Expand the response with the full logical operator
+ details. Optional.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing details of the specified LogicalOperator
+ definition.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _get_integration_logical_operator(
+ self,
+ integration_name,
+ logical_operator_id,
+ expand=expand,
+ api_version=api_version,
+ )
+
+ def delete_integration_logical_operator(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> None:
+ """Delete a custom logical operator definition from a given integration.
+
+ Use this method to permanently remove an obsolete logical operator
+ from an integration.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to delete.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _delete_integration_logical_operator(
+ self,
+ integration_name,
+ logical_operator_id,
+ api_version=api_version,
+ )
+
+ def create_integration_logical_operator(
+ self,
+ integration_name: str,
+ display_name: str,
+ script: str,
+ script_timeout: str,
+ enabled: bool,
+ description: str | None = None,
+ parameters: list[dict[str, Any]] | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Create a new logical operator definition for a given integration.
+
+ Use this method to define a logical operator, specifying its
+ functional Python script and necessary input parameters for
+ conditional evaluations.
+
+ Args:
+ integration_name: Name of the integration to create the
+ logical operator for.
+ display_name: Logical operator's display name. Maximum 150
+ characters. Required.
+ script: Logical operator's Python script. Required.
+ script_timeout: Timeout in seconds for a single script run.
+ Default is 60. Required.
+ enabled: Whether the logical operator is enabled or disabled.
+ Required.
+ description: Logical operator's description. Maximum 2050
+ characters. Optional.
+ parameters: List of logical operator parameter dicts. Optional.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the newly created LogicalOperator resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _create_integration_logical_operator(
+ self,
+ integration_name,
+ display_name,
+ script,
+ script_timeout,
+ enabled,
+ description=description,
+ parameters=parameters,
+ api_version=api_version,
+ )
+
+ def update_integration_logical_operator(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ display_name: str | None = None,
+ script: str | None = None,
+ script_timeout: str | None = None,
+ enabled: bool | None = None,
+ description: str | None = None,
+ parameters: list[dict[str, Any]] | None = None,
+ update_mask: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Update an existing logical operator definition for a given
+ integration.
+
+ Use this method to modify a logical operator's Python script,
+ adjust its description, or refine its parameter definitions.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to update.
+ display_name: Logical operator's display name. Maximum 150
+ characters.
+ script: Logical operator's Python script.
+ script_timeout: Timeout in seconds for a single script run.
+ enabled: Whether the logical operator is enabled or disabled.
+ description: Logical operator's description. Maximum 2050
+ characters.
+ parameters: List of logical operator parameter dicts. When
+ updating existing parameters, id must be provided in each
+ parameter.
+ update_mask: Comma-separated list of fields to update. If
+ omitted, the mask is auto-generated from whichever fields
+ are provided. Example: "displayName,script".
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the updated LogicalOperator resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _update_integration_logical_operator(
+ self,
+ integration_name,
+ logical_operator_id,
+ display_name=display_name,
+ script=script,
+ script_timeout=script_timeout,
+ enabled=enabled,
+ description=description,
+ parameters=parameters,
+ update_mask=update_mask,
+ api_version=api_version,
+ )
+
+ def execute_integration_logical_operator_test(
+ self,
+ integration_name: str,
+ logical_operator: dict[str, Any],
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Execute a test run of a logical operator's Python script.
+
+ Use this method to verify logical operator evaluation logic and
+ ensure conditions are being assessed correctly before saving or
+ deploying the operator. The full logical operator object is
+ required as the test can be run without saving the operator first.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator: Dict containing the LogicalOperator
+ definition to test.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the test execution results with the following
+ fields:
+ - outputMessage: Human-readable output message set by the
+ script.
+ - debugOutputMessage: The script debug output.
+ - resultValue: The script result value (True/False).
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _execute_integration_logical_operator_test(
+ self,
+ integration_name,
+ logical_operator,
+ api_version=api_version,
+ )
+
+ def get_integration_logical_operator_template(
+ self,
+ integration_name: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Retrieve a default Python script template for a new logical operator.
+
+ Use this method to jumpstart the development of a custom
+ conditional logic by providing boilerplate code.
+
+ Args:
+ integration_name: Name of the integration to fetch the template
+ for.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the LogicalOperator template.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _get_integration_logical_operator_template(
+ self,
+ integration_name,
+ api_version=api_version,
+ )
+
+ # -- Integration Logical Operator Revisions methods --
+
+ def list_integration_logical_operator_revisions(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+ ) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all revisions for a specific logical operator.
+
+ Use this method to view the revision history of a logical operator,
+ enabling you to track changes and potentially rollback to previous
+ versions.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to list
+ revisions for.
+ page_size: Maximum number of revisions to return. Defaults to
+ 100, maximum is 200.
+ page_token: Page token from a previous call to retrieve the
+ next page.
+ filter_string: Filter expression to filter revisions.
+ order_by: Field to sort the revisions by.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+ as_list: If True, automatically fetches all pages and returns
+ a list of revisions. If False, returns dict with revisions
+ and nextPageToken.
+
+ Returns:
+ If as_list is True: List of logical operator revisions.
+ If as_list is False: Dict with revisions list and nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _list_integration_logical_operator_revisions(
+ self,
+ integration_name,
+ logical_operator_id,
+ page_size=page_size,
+ page_token=page_token,
+ filter_string=filter_string,
+ order_by=order_by,
+ api_version=api_version,
+ as_list=as_list,
+ )
+
+ def delete_integration_logical_operator_revision(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> None:
+ """Delete a specific logical operator revision.
+
+ Use this method to remove obsolete or incorrect revisions from
+ a logical operator's history.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator.
+ revision_id: ID of the revision to delete.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _delete_integration_logical_operator_revision(
+ self,
+ integration_name,
+ logical_operator_id,
+ revision_id,
+ api_version=api_version,
+ )
+
+ def create_integration_logical_operator_revision(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ logical_operator: dict[str, Any],
+ comment: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Create a new revision for a logical operator.
+
+ Use this method to create a snapshot of the logical operator's
+ current state before making changes, enabling you to rollback if
+ needed.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to create a
+ revision for.
+ logical_operator: Dict containing the LogicalOperator
+ definition to save as a revision.
+ comment: Optional comment describing the revision or changes.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the newly created LogicalOperatorRevision
+ resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _create_integration_logical_operator_revision(
+ self,
+ integration_name,
+ logical_operator_id,
+ logical_operator,
+ comment=comment,
+ api_version=api_version,
+ )
+
+ def rollback_integration_logical_operator_revision(
+ self,
+ integration_name: str,
+ logical_operator_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ ) -> dict[str, Any]:
+ """Rollback a logical operator to a previous revision.
+
+ Use this method to restore a logical operator to a previous
+ working state by rolling back to a specific revision.
+
+ Args:
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to rollback.
+ revision_id: ID of the revision to rollback to.
+ api_version: API version to use for the request. Default is
+ V1ALPHA.
+
+ Returns:
+ Dict containing the updated LogicalOperator resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return _rollback_integration_logical_operator_revision(
+ self,
+ integration_name,
+ logical_operator_id,
+ revision_id,
+ api_version=api_version,
+ )
+
def get_stats(
self,
query: str,
diff --git a/src/secops/chronicle/entity.py b/src/secops/chronicle/entity.py
index 429d4393..84e5060a 100644
--- a/src/secops/chronicle/entity.py
+++ b/src/secops/chronicle/entity.py
@@ -15,6 +15,7 @@
"""
Provides entity search, analysis and summarization functionality for Chronicle.
"""
+
import ipaddress
import re
from datetime import datetime
diff --git a/src/secops/chronicle/feeds.py b/src/secops/chronicle/feeds.py
index b9ed7f22..8030b753 100644
--- a/src/secops/chronicle/feeds.py
+++ b/src/secops/chronicle/feeds.py
@@ -15,6 +15,7 @@
"""
Provides ingestion feed management functionality for Chronicle.
"""
+
import json
import os
import sys
diff --git a/src/secops/chronicle/gemini.py b/src/secops/chronicle/gemini.py
index abed52cb..eee42374 100644
--- a/src/secops/chronicle/gemini.py
+++ b/src/secops/chronicle/gemini.py
@@ -16,6 +16,7 @@
Provides access to Chronicle's Gemini conversational AI interface.
"""
+
import re
from typing import Any
diff --git a/src/secops/chronicle/integration/__init__.py b/src/secops/chronicle/integration/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/secops/chronicle/integration/logical_operator_revisions.py b/src/secops/chronicle/integration/logical_operator_revisions.py
new file mode 100644
index 00000000..f7f00cee
--- /dev/null
+++ b/src/secops/chronicle/integration/logical_operator_revisions.py
@@ -0,0 +1,212 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Integration logical operator revisions functionality for Chronicle."""
+
+from typing import Any, TYPE_CHECKING
+
+from secops.chronicle.models import APIVersion
+from secops.chronicle.utils.format_utils import format_resource_id
+from secops.chronicle.utils.request_utils import (
+ chronicle_paginated_request,
+ chronicle_request,
+)
+
+if TYPE_CHECKING:
+ from secops.chronicle.client import ChronicleClient
+
+
+def list_integration_logical_operator_revisions(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all revisions for a specific integration logical operator.
+
+ Use this method to browse through the version history of a custom logical
+ operator definition.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to list revisions for.
+ page_size: Maximum number of revisions to return.
+ page_token: Page token from a previous call to retrieve the next page.
+ filter_string: Filter expression to filter revisions.
+ order_by: Field to sort the revisions by.
+ api_version: API version to use for the request. Default is V1ALPHA.
+ as_list: If True, return a list of revisions instead of a dict with
+ revisions list and nextPageToken.
+
+ Returns:
+ If as_list is True: List of revisions.
+ If as_list is False: Dict with revisions list and nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ extra_params = {
+ "filter": filter_string,
+ "orderBy": order_by,
+ }
+
+ # Remove keys with None values
+ extra_params = {k: v for k, v in extra_params.items() if v is not None}
+
+ return chronicle_paginated_request(
+ client,
+ api_version=api_version,
+ path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}/revisions"
+ ),
+ items_key="revisions",
+ page_size=page_size,
+ page_token=page_token,
+ extra_params=extra_params,
+ as_list=as_list,
+ )
+
+
+def delete_integration_logical_operator_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> None:
+ """Delete a specific revision for a given integration logical operator.
+
+ Permanently removes the versioned snapshot from the logical operator's
+ history.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator the revision belongs
+ to.
+ revision_id: ID of the revision to delete.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ chronicle_request(
+ client,
+ method="DELETE",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}/revisions/{revision_id}"
+ ),
+ api_version=api_version,
+ )
+
+
+def create_integration_logical_operator_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ logical_operator: dict[str, Any],
+ comment: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Create a new revision snapshot of the current integration
+ logical operator.
+
+ Use this method to save the current state of a logical operator
+ definition. Revisions can only be created for custom logical operators.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to create a revision
+ for.
+ logical_operator: Dict containing the IntegrationLogicalOperator to
+ snapshot.
+ comment: Comment describing the revision. Maximum 400 characters.
+ Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the newly created IntegrationLogicalOperatorRevision
+ resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ body = {"logicalOperator": logical_operator}
+
+ if comment is not None:
+ body["comment"] = comment
+
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}/revisions"
+ ),
+ api_version=api_version,
+ json=body,
+ )
+
+
+def rollback_integration_logical_operator_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Roll back the current logical operator to a previously saved revision.
+
+ This updates the active logical operator definition with the configuration
+ stored in the specified revision.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to rollback.
+ revision_id: ID of the revision to rollback to.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the IntegrationLogicalOperatorRevision rolled back to.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}/revisions/"
+ f"{revision_id}:rollback"
+ ),
+ api_version=api_version,
+ )
diff --git a/src/secops/chronicle/integration/logical_operators.py b/src/secops/chronicle/integration/logical_operators.py
new file mode 100644
index 00000000..fe5da103
--- /dev/null
+++ b/src/secops/chronicle/integration/logical_operators.py
@@ -0,0 +1,411 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Integration logical operators functionality for Chronicle."""
+
+from typing import Any, TYPE_CHECKING
+
+from secops.chronicle.models import (
+ APIVersion,
+ IntegrationLogicalOperatorParameter,
+)
+from secops.chronicle.utils.format_utils import (
+ format_resource_id,
+ build_patch_body,
+)
+from secops.chronicle.utils.request_utils import (
+ chronicle_paginated_request,
+ chronicle_request,
+)
+
+if TYPE_CHECKING:
+ from secops.chronicle.client import ChronicleClient
+
+
+def list_integration_logical_operators(
+ client: "ChronicleClient",
+ integration_name: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ exclude_staging: bool | None = None,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all logical operator definitions for a specific integration.
+
+ Use this method to discover the custom logic operators available for use
+ within playbook decision steps.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to list logical operators
+ for.
+ page_size: Maximum number of logical operators to return. Defaults
+ to 100, maximum is 200.
+ page_token: Page token from a previous call to retrieve the next page.
+ filter_string: Filter expression to filter logical operators.
+ order_by: Field to sort the logical operators by.
+ exclude_staging: Whether to exclude staging logical operators from
+ the response. By default, staging logical operators are included.
+ expand: Expand the response with the full logical operator details.
+ api_version: API version to use for the request. Default is V1ALPHA.
+ as_list: If True, return a list of logical operators instead of a
+ dict with logical operators list and nextPageToken.
+
+ Returns:
+ If as_list is True: List of logical operators.
+ If as_list is False: Dict with logical operators list and
+ nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ extra_params = {
+ "filter": filter_string,
+ "orderBy": order_by,
+ "excludeStaging": exclude_staging,
+ "expand": expand,
+ }
+
+ # Remove keys with None values
+ extra_params = {k: v for k, v in extra_params.items() if v is not None}
+
+ return chronicle_paginated_request(
+ client,
+ api_version=api_version,
+ path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators"
+ ),
+ items_key="logicalOperators",
+ page_size=page_size,
+ page_token=page_token,
+ extra_params=extra_params,
+ as_list=as_list,
+ )
+
+
+def get_integration_logical_operator(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Get a single logical operator definition for a specific integration.
+
+ Use this method to retrieve the Python script, evaluation parameters,
+ and description for a custom logical operator.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to retrieve.
+ expand: Expand the response with the full logical operator details.
+ Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing details of the specified IntegrationLogicalOperator.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ params = {}
+ if expand is not None:
+ params["expand"] = expand
+
+ return chronicle_request(
+ client,
+ method="GET",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}"
+ ),
+ api_version=api_version,
+ params=params if params else None,
+ )
+
+
+def delete_integration_logical_operator(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> None:
+ """Delete a specific custom logical operator from a given integration.
+
+ Only custom logical operators can be deleted; predefined built-in
+ operators are immutable.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to delete.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ chronicle_request(
+ client,
+ method="DELETE",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}"
+ ),
+ api_version=api_version,
+ )
+
+
+def create_integration_logical_operator(
+ client: "ChronicleClient",
+ integration_name: str,
+ display_name: str,
+ script: str,
+ script_timeout: str,
+ enabled: bool,
+ description: str | None = None,
+ parameters: (
+ list[dict[str, Any] | IntegrationLogicalOperatorParameter] | None
+ ) = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Create a new custom logical operator for a given integration.
+
+ Each operator must have a unique display name and a functional Python
+ script that returns a boolean result.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to create the logical
+ operator for.
+ display_name: Logical operator's display name. Maximum 150
+ characters. Required.
+ script: Logical operator's Python script. Required.
+ script_timeout: Timeout in seconds for a single script run. Default
+ is 60. Required.
+ enabled: Whether the logical operator is enabled or disabled.
+ Required.
+ description: Logical operator's description. Maximum 2050 characters.
+ Optional.
+ parameters: List of IntegrationLogicalOperatorParameter instances or
+ dicts. Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the newly created IntegrationLogicalOperator resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ resolved_parameters = (
+ [
+ (
+ p.to_dict()
+ if isinstance(p, IntegrationLogicalOperatorParameter)
+ else p
+ )
+ for p in parameters
+ ]
+ if parameters is not None
+ else None
+ )
+
+ body = {
+ "displayName": display_name,
+ "script": script,
+ "scriptTimeout": script_timeout,
+ "enabled": enabled,
+ "description": description,
+ "parameters": resolved_parameters,
+ }
+
+ # Remove keys with None values
+ body = {k: v for k, v in body.items() if v is not None}
+
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators"
+ ),
+ api_version=api_version,
+ json=body,
+ )
+
+
+def update_integration_logical_operator(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator_id: str,
+ display_name: str | None = None,
+ script: str | None = None,
+ script_timeout: str | None = None,
+ enabled: bool | None = None,
+ description: str | None = None,
+ parameters: (
+ list[dict[str, Any] | IntegrationLogicalOperatorParameter] | None
+ ) = None,
+ update_mask: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Update an existing custom logical operator for a given integration.
+
+ Use this method to modify the logical operator script, refine parameter
+ descriptions, or adjust the timeout for a logical operator.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator_id: ID of the logical operator to update.
+ display_name: Logical operator's display name. Maximum 150 characters.
+ script: Logical operator's Python script.
+ script_timeout: Timeout in seconds for a single script run.
+ enabled: Whether the logical operator is enabled or disabled.
+ description: Logical operator's description. Maximum 2050 characters.
+ parameters: List of IntegrationLogicalOperatorParameter instances or
+ dicts. When updating existing parameters, id must be provided
+ in each IntegrationLogicalOperatorParameter.
+ update_mask: Comma-separated list of fields to update. If omitted,
+ the mask is auto-generated from whichever fields are provided.
+ Example: "displayName,script".
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the updated IntegrationLogicalOperator resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ resolved_parameters = (
+ [
+ (
+ p.to_dict()
+ if isinstance(p, IntegrationLogicalOperatorParameter)
+ else p
+ )
+ for p in parameters
+ ]
+ if parameters is not None
+ else None
+ )
+
+ body, params = build_patch_body(
+ field_map=[
+ ("displayName", "displayName", display_name),
+ ("script", "script", script),
+ ("scriptTimeout", "scriptTimeout", script_timeout),
+ ("enabled", "enabled", enabled),
+ ("description", "description", description),
+ ("parameters", "parameters", resolved_parameters),
+ ],
+ update_mask=update_mask,
+ )
+
+ return chronicle_request(
+ client,
+ method="PATCH",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators/{logical_operator_id}"
+ ),
+ api_version=api_version,
+ json=body,
+ params=params,
+ )
+
+
+def execute_integration_logical_operator_test(
+ client: "ChronicleClient",
+ integration_name: str,
+ logical_operator: dict[str, Any],
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Execute a test run of a logical operator's evaluation script.
+
+ Use this method to verify decision logic and ensure it correctly handles
+ various input data before deployment in a playbook. The full logical
+ operator object is required as the test can be run without saving the
+ logical operator first.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the logical operator
+ belongs to.
+ logical_operator: Dict containing the IntegrationLogicalOperator to
+ test.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the test execution results with the following fields:
+ - outputMessage: Human-readable output message set by the script.
+ - debugOutputMessage: The script debug output.
+ - resultValue: The script result value.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators:executeTest"
+ ),
+ api_version=api_version,
+ json={"logicalOperator": logical_operator},
+ )
+
+
+def get_integration_logical_operator_template(
+ client: "ChronicleClient",
+ integration_name: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Retrieve a default Python script template for a new logical operator.
+
+ Use this method to rapidly initialize the development of a new logical
+ operator.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to fetch the template for.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the IntegrationLogicalOperator template.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="GET",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"logicalOperators:fetchTemplate"
+ ),
+ api_version=api_version,
+ )
diff --git a/src/secops/chronicle/integration/transformer_revisions.py b/src/secops/chronicle/integration/transformer_revisions.py
new file mode 100644
index 00000000..397d3fbf
--- /dev/null
+++ b/src/secops/chronicle/integration/transformer_revisions.py
@@ -0,0 +1,202 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Integration transformer revisions functionality for Chronicle."""
+
+from typing import Any, TYPE_CHECKING
+
+from secops.chronicle.models import APIVersion
+from secops.chronicle.utils.format_utils import format_resource_id
+from secops.chronicle.utils.request_utils import (
+ chronicle_paginated_request,
+ chronicle_request,
+)
+
+if TYPE_CHECKING:
+ from secops.chronicle.client import ChronicleClient
+
+
+def list_integration_transformer_revisions(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+ as_list: bool = False,
+) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all revisions for a specific integration transformer.
+
+ Use this method to browse through the version history of a custom
+ transformer definition.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to list revisions for.
+ page_size: Maximum number of revisions to return.
+ page_token: Page token from a previous call to retrieve the next page.
+ filter_string: Filter expression to filter revisions.
+ order_by: Field to sort the revisions by.
+ api_version: API version to use for the request. Default is V1ALPHA.
+ as_list: If True, return a list of revisions instead of a dict with
+ revisions list and nextPageToken.
+
+ Returns:
+ If as_list is True: List of revisions.
+ If as_list is False: Dict with revisions list and nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ extra_params = {
+ "filter": filter_string,
+ "orderBy": order_by,
+ }
+
+ # Remove keys with None values
+ extra_params = {k: v for k, v in extra_params.items() if v is not None}
+
+ return chronicle_paginated_request(
+ client,
+ api_version=api_version,
+ path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}/revisions"
+ ),
+ items_key="revisions",
+ page_size=page_size,
+ page_token=page_token,
+ extra_params=extra_params,
+ as_list=as_list,
+ )
+
+
+def delete_integration_transformer_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> None:
+ """Delete a specific revision for a given integration transformer.
+
+ Permanently removes the versioned snapshot from the transformer's history.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer the revision belongs to.
+ revision_id: ID of the revision to delete.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ chronicle_request(
+ client,
+ method="DELETE",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}/revisions/{revision_id}"
+ ),
+ api_version=api_version,
+ )
+
+
+def create_integration_transformer_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ transformer: dict[str, Any],
+ comment: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Create a new revision snapshot of the current integration transformer.
+
+ Use this method to save the current state of a transformer definition.
+ Revisions can only be created for custom transformers.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to create a revision for.
+ transformer: Dict containing the TransformerDefinition to snapshot.
+ comment: Comment describing the revision. Maximum 400 characters.
+ Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the newly created TransformerRevision resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ body = {"transformer": transformer}
+
+ if comment is not None:
+ body["comment"] = comment
+
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}/revisions"
+ ),
+ api_version=api_version,
+ json=body,
+ )
+
+
+def rollback_integration_transformer_revision(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ revision_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Roll back the current transformer definition to
+ a previously saved revision.
+
+ This updates the active transformer definition with the configuration
+ stored in the specified revision.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to rollback.
+ revision_id: ID of the revision to rollback to.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the TransformerRevision rolled back to.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}/revisions/{revision_id}:rollback"
+ ),
+ api_version=api_version,
+ )
diff --git a/src/secops/chronicle/integration/transformers.py b/src/secops/chronicle/integration/transformers.py
new file mode 100644
index 00000000..a2a0b817
--- /dev/null
+++ b/src/secops/chronicle/integration/transformers.py
@@ -0,0 +1,406 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Integration transformers functionality for Chronicle."""
+
+from typing import Any, TYPE_CHECKING
+
+from secops.chronicle.models import APIVersion, TransformerDefinitionParameter
+from secops.chronicle.utils.format_utils import (
+ format_resource_id,
+ build_patch_body,
+)
+from secops.chronicle.utils.request_utils import (
+ chronicle_paginated_request,
+ chronicle_request,
+)
+
+if TYPE_CHECKING:
+ from secops.chronicle.client import ChronicleClient
+
+
+def list_integration_transformers(
+ client: "ChronicleClient",
+ integration_name: str,
+ page_size: int | None = None,
+ page_token: str | None = None,
+ filter_string: str | None = None,
+ order_by: str | None = None,
+ exclude_staging: bool | None = None,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any] | list[dict[str, Any]]:
+ """List all transformer definitions for a specific integration.
+
+ Use this method to browse the available transformers.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to list transformers for.
+ page_size: Maximum number of transformers to return. Defaults to 100,
+ maximum is 200.
+ page_token: Page token from a previous call to retrieve the next page.
+ filter_string: Filter expression to filter transformers.
+ order_by: Field to sort the transformers by.
+ exclude_staging: Whether to exclude staging transformers from the
+ response. By default, staging transformers are included.
+ expand: Expand the response with the full transformer details.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ If as_list is True: List of transformers.
+ If as_list is False: Dict with transformers list and nextPageToken.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ extra_params = {
+ "filter": filter_string,
+ "orderBy": order_by,
+ "excludeStaging": exclude_staging,
+ "expand": expand,
+ }
+
+ # Remove keys with None values
+ extra_params = {k: v for k, v in extra_params.items() if v is not None}
+
+ return chronicle_paginated_request(
+ client,
+ api_version=api_version,
+ path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers"
+ ),
+ items_key="transformers",
+ page_size=page_size,
+ page_token=page_token,
+ extra_params=extra_params,
+ as_list=False,
+ )
+
+
+def get_integration_transformer(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ expand: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Get a single transformer definition for a specific integration.
+
+ Use this method to retrieve the Python script, input parameters, and
+ expected input, output and usage example schema for a specific data
+ transformation logic within an integration.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to retrieve.
+ expand: Expand the response with the full transformer details.
+ Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing details of the specified TransformerDefinition.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ params = {}
+ if expand is not None:
+ params["expand"] = expand
+
+ return chronicle_request(
+ client,
+ method="GET",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}"
+ ),
+ api_version=api_version,
+ params=params if params else None,
+ )
+
+
+def delete_integration_transformer(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> None:
+ """Delete a custom transformer definition from a given integration.
+
+ Use this method to permanently remove an obsolete transformer from an
+ integration.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to delete.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ None
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ chronicle_request(
+ client,
+ method="DELETE",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}"
+ ),
+ api_version=api_version,
+ )
+
+
+def create_integration_transformer(
+ client: "ChronicleClient",
+ integration_name: str,
+ display_name: str,
+ script: str,
+ script_timeout: str,
+ enabled: bool,
+ description: str | None = None,
+ parameters: (
+ list[dict[str, Any] | TransformerDefinitionParameter] | None
+ ) = None,
+ usage_example: str | None = None,
+ expected_output: str | None = None,
+ expected_input: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Create a new transformer definition for a given integration.
+
+ Use this method to define a transformer, specifying its functional Python
+ script and necessary input parameters.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to create the transformer
+ for.
+ display_name: Transformer's display name. Maximum 150 characters.
+ Required.
+ script: Transformer's Python script. Required.
+ script_timeout: Timeout in seconds for a single script run. Default
+ is 60. Required.
+ enabled: Whether the transformer is enabled or disabled. Required.
+ description: Transformer's description. Maximum 2050 characters.
+ Optional.
+ parameters: List of TransformerDefinitionParameter instances or
+ dicts. Optional.
+ usage_example: Transformer's usage example. Optional.
+ expected_output: Transformer's expected output. Optional.
+ expected_input: Transformer's expected input. Optional.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the newly created TransformerDefinition resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ resolved_parameters = (
+ [
+ p.to_dict() if isinstance(p, TransformerDefinitionParameter) else p
+ for p in parameters
+ ]
+ if parameters is not None
+ else None
+ )
+
+ body = {
+ "displayName": display_name,
+ "script": script,
+ "scriptTimeout": script_timeout,
+ "enabled": enabled,
+ "description": description,
+ "parameters": resolved_parameters,
+ "usageExample": usage_example,
+ "expectedOutput": expected_output,
+ "expectedInput": expected_input,
+ }
+
+ # Remove keys with None values
+ body = {k: v for k, v in body.items() if v is not None}
+
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/transformers"
+ ),
+ api_version=api_version,
+ json=body,
+ )
+
+
+def update_integration_transformer(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer_id: str,
+ display_name: str | None = None,
+ script: str | None = None,
+ script_timeout: str | None = None,
+ enabled: bool | None = None,
+ description: str | None = None,
+ parameters: (
+ list[dict[str, Any] | TransformerDefinitionParameter] | None
+ ) = None,
+ usage_example: str | None = None,
+ expected_output: str | None = None,
+ expected_input: str | None = None,
+ update_mask: str | None = None,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Update an existing transformer definition for a given integration.
+
+ Use this method to modify a transformation's Python script, adjust its
+ description, or refine its parameter definitions.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer_id: ID of the transformer to update.
+ display_name: Transformer's display name. Maximum 150 characters.
+ script: Transformer's Python script.
+ script_timeout: Timeout in seconds for a single script run.
+ enabled: Whether the transformer is enabled or disabled.
+ description: Transformer's description. Maximum 2050 characters.
+ parameters: List of TransformerDefinitionParameter instances or
+ dicts. When updating existing parameters, id must be provided
+ in each TransformerDefinitionParameter.
+ usage_example: Transformer's usage example.
+ expected_output: Transformer's expected output.
+ expected_input: Transformer's expected input.
+ update_mask: Comma-separated list of fields to update. If omitted,
+ the mask is auto-generated from whichever fields are provided.
+ Example: "displayName,script".
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the updated TransformerDefinition resource.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ resolved_parameters = (
+ [
+ p.to_dict() if isinstance(p, TransformerDefinitionParameter) else p
+ for p in parameters
+ ]
+ if parameters is not None
+ else None
+ )
+
+ body, params = build_patch_body(
+ field_map=[
+ ("displayName", "displayName", display_name),
+ ("script", "script", script),
+ ("scriptTimeout", "scriptTimeout", script_timeout),
+ ("enabled", "enabled", enabled),
+ ("description", "description", description),
+ ("parameters", "parameters", resolved_parameters),
+ ("usageExample", "usageExample", usage_example),
+ ("expectedOutput", "expectedOutput", expected_output),
+ ("expectedInput", "expectedInput", expected_input),
+ ],
+ update_mask=update_mask,
+ )
+
+ return chronicle_request(
+ client,
+ method="PATCH",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers/{transformer_id}"
+ ),
+ api_version=api_version,
+ json=body,
+ params=params,
+ )
+
+
+def execute_integration_transformer_test(
+ client: "ChronicleClient",
+ integration_name: str,
+ transformer: dict[str, Any],
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Execute a test run of a transformer's Python script.
+
+ Use this method to verify transformation logic and ensure data is being
+ parsed and formatted correctly before saving or deploying the transformer.
+ The full transformer object is required as the test can be run without
+ saving the transformer first.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration the transformer belongs to.
+ transformer: Dict containing the TransformerDefinition to test.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the test execution results with the following fields:
+ - outputMessage: Human-readable output message set by the script.
+ - debugOutputMessage: The script debug output.
+ - resultValue: The script result value.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="POST",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers:executeTest"
+ ),
+ api_version=api_version,
+ json={"transformer": transformer},
+ )
+
+
+def get_integration_transformer_template(
+ client: "ChronicleClient",
+ integration_name: str,
+ api_version: APIVersion | None = APIVersion.V1ALPHA,
+) -> dict[str, Any]:
+ """Retrieve a default Python script template for a new transformer.
+
+ Use this method to jumpstart the development of a custom data
+ transformation logic by providing boilerplate code.
+
+ Args:
+ client: ChronicleClient instance.
+ integration_name: Name of the integration to fetch the template for.
+ api_version: API version to use for the request. Default is V1ALPHA.
+
+ Returns:
+ Dict containing the TransformerDefinition template.
+
+ Raises:
+ APIError: If the API request fails.
+ """
+ return chronicle_request(
+ client,
+ method="GET",
+ endpoint_path=(
+ f"integrations/{format_resource_id(integration_name)}/"
+ f"transformers:fetchTemplate"
+ ),
+ api_version=api_version,
+ )
diff --git a/src/secops/chronicle/models.py b/src/secops/chronicle/models.py
index 0074bc53..06d81da9 100644
--- a/src/secops/chronicle/models.py
+++ b/src/secops/chronicle/models.py
@@ -13,6 +13,7 @@
# limitations under the License.
#
"""Data models for Chronicle API responses."""
+
import json
import sys
from dataclasses import asdict, dataclass, field
@@ -73,6 +74,686 @@ class DetectionType(StrEnum):
CASE = "DETECTION_TYPE_CASE"
+class PythonVersion(str, Enum):
+ """Python version for compatibility checks."""
+
+ UNSPECIFIED = "PYTHON_VERSION_UNSPECIFIED"
+ PYTHON_2_7 = "V2_7"
+ PYTHON_3_7 = "V3_7"
+ PYTHON_3_11 = "V3_11"
+
+
+class DiffType(str, Enum):
+ """Type of diff to retrieve."""
+
+ COMMERCIAL = "Commercial"
+ PRODUCTION = "Production"
+ STAGING = "Staging"
+
+
+class TargetMode(str, Enum):
+ """Target mode for integration transition."""
+
+ PRODUCTION = "Production"
+ STAGING = "Staging"
+
+
+class IntegrationType(str, Enum):
+ """Type of integration."""
+
+ UNSPECIFIED = "INTEGRATION_TYPE_UNSPECIFIED"
+ RESPONSE = "RESPONSE"
+ EXTENSION = "EXTENSION"
+
+
+class IntegrationParamType(str, Enum):
+ """Type of integration parameter."""
+
+ PARAM_TYPE_UNSPECIFIED = "PARAM_TYPE_UNSPECIFIED"
+ BOOLEAN = "BOOLEAN"
+ INT = "INT"
+ STRING = "STRING"
+ PASSWORD = "PASSWORD"
+ IP = "IP"
+ IP_OR_HOST = "IP_OR_HOST"
+ URL = "URL"
+ DOMAIN = "DOMAIN"
+ EMAIL = "EMAIL"
+ VALUES_LIST = "VALUES_LIST"
+ VALUES_AS_SEMICOLON_SEPARATED_STRING = (
+ "VALUES_AS_SEMICOLON_SEPARATED_STRING"
+ )
+ MULTI_VALUES_SELECTION = "MULTI_VALUES_SELECTION"
+ SCRIPT = "SCRIPT"
+ FILTER_LIST = "FILTER_LIST"
+
+
+@dataclass
+class IntegrationParam:
+ """A parameter definition for a Chronicle SOAR integration.
+
+ Attributes:
+ display_name: Human-readable label shown in the UI.
+ property_name: The programmatic key used in code/config.
+ type: The data type of the parameter (see IntegrationParamType).
+ description: Optional. Explanation of what the parameter is for.
+ mandatory: Whether the parameter must be supplied. Defaults to False.
+ default_value: Optional. Pre-filled value shown in the UI.
+ """
+
+ display_name: str
+ property_name: str
+ type: IntegrationParamType
+ mandatory: bool
+ description: str | None = None
+ default_value: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "displayName": self.display_name,
+ "propertyName": self.property_name,
+ "type": str(self.type.value),
+ "mandatory": self.mandatory,
+ }
+ if self.description is not None:
+ data["description"] = self.description
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ return data
+
+
+class ActionParamType(str, Enum):
+ """Action parameter types for Chronicle SOAR integration actions."""
+
+ STRING = "STRING"
+ BOOLEAN = "BOOLEAN"
+ WFS_REPOSITORY = "WFS_REPOSITORY"
+ USER_REPOSITORY = "USER_REPOSITORY"
+ STAGES_REPOSITORY = "STAGES_REPOSITORY"
+ CLOSE_CASE_REASON_REPOSITORY = "CLOSE_CASE_REASON_REPOSITORY"
+ CLOSE_CASE_ROOT_CAUSE_REPOSITORY = "CLOSE_CASE_ROOT_CAUSE_REPOSITORY"
+ PRIORITIES_REPOSITORY = "PRIORITIES_REPOSITORY"
+ EMAIL_CONTENT = "EMAIL_CONTENT"
+ CONTENT = "CONTENT"
+ PASSWORD = "PASSWORD"
+ ENTITY_TYPE = "ENTITY_TYPE"
+ MULTI_VALUES = "MULTI_VALUES"
+ LIST = "LIST"
+ CODE = "CODE"
+ MULTIPLE_CHOICE_PARAMETER = "MULTIPLE_CHOICE_PARAMETER"
+
+
+class ActionType(str, Enum):
+ """Action types for Chronicle SOAR integration actions."""
+
+ UNSPECIFIED = "ACTION_TYPE_UNSPECIFIED"
+ STANDARD = "STANDARD"
+ AI_AGENT = "AI_AGENT"
+
+
+@dataclass
+class ActionParameter:
+ """A parameter definition for a Chronicle SOAR integration action.
+
+ Attributes:
+ display_name: The parameter's display name. Maximum 150 characters.
+ type: The parameter's type.
+ description: The parameter's description. Maximum 150 characters.
+ mandatory: Whether the parameter is mandatory.
+ default_value: The default value of the parameter.
+ Maximum 150 characters.
+ optional_values: Parameter's optional values. Maximum 50 items.
+ """
+
+ display_name: str
+ type: ActionParamType
+ description: str
+ mandatory: bool
+ default_value: str | None = None
+ optional_values: list[str] | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "displayName": self.display_name,
+ "type": str(self.type.value),
+ "description": self.description,
+ "mandatory": self.mandatory,
+ }
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ if self.optional_values is not None:
+ data["optionalValues"] = self.optional_values
+ return data
+
+
+class ParamType(str, Enum):
+ """Parameter types for Chronicle SOAR integration functions."""
+
+ UNSPECIFIED = "PARAM_TYPE_UNSPECIFIED"
+ BOOLEAN = "BOOLEAN"
+ INT = "INT"
+ STRING = "STRING"
+ PASSWORD = "PASSWORD"
+ IP = "IP"
+ IP_OR_HOST = "IP_OR_HOST"
+ URL = "URL"
+ DOMAIN = "DOMAIN"
+ EMAIL = "EMAIL"
+ VALUES_LIST = "VALUES_LIST"
+ VALUES_AS_SEMICOLON_SEPARATED_STRING = (
+ "VALUES_AS_SEMICOLON_SEPARATED_STRING"
+ )
+ MULTI_VALUES_SELECTION = "MULTI_VALUES_SELECTION"
+ SCRIPT = "SCRIPT"
+ FILTER_LIST = "FILTER_LIST"
+ NUMERICAL_VALUES = "NUMERICAL_VALUES"
+
+
+class ConnectorParamMode(str, Enum):
+ """Parameter modes for Chronicle SOAR integration connectors."""
+
+ UNSPECIFIED = "PARAM_MODE_UNSPECIFIED"
+ REGULAR = "REGULAR"
+ CONNECTIVITY = "CONNECTIVITY"
+ SCRIPT = "SCRIPT"
+
+
+class ConnectorRuleType(str, Enum):
+ """Rule types for Chronicle SOAR integration connectors."""
+
+ UNSPECIFIED = "RULE_TYPE_UNSPECIFIED"
+ ALLOW_LIST = "ALLOW_LIST"
+ BLOCK_LIST = "BLOCK_LIST"
+
+
+@dataclass
+class ConnectorParameter:
+ """A parameter definition for a Chronicle SOAR integration connector.
+
+ Attributes:
+ display_name: The parameter's display name.
+ type: The parameter's type.
+ mode: The parameter's mode.
+ mandatory: Whether the parameter is mandatory for configuring a
+ connector instance.
+ default_value: The default value of the parameter. Required for
+ boolean and mandatory parameters.
+ description: The parameter's description.
+ advanced: The parameter's advanced flag.
+ """
+
+ display_name: str
+ type: ParamType
+ mode: ConnectorParamMode
+ mandatory: bool
+ default_value: str | None = None
+ description: str | None = None
+ advanced: bool | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "displayName": self.display_name,
+ "type": str(self.type.value),
+ "mode": str(self.mode.value),
+ "mandatory": self.mandatory,
+ }
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ if self.description is not None:
+ data["description"] = self.description
+ if self.advanced is not None:
+ data["advanced"] = self.advanced
+ return data
+
+
+@dataclass
+class IntegrationJobInstanceParameter:
+ """A parameter instance for a Chronicle SOAR integration job instance.
+
+ Note: Most fields are output-only and will be populated by the API.
+ Only value needs to be provided when configuring a job instance.
+
+ Attributes:
+ value: The value of the parameter.
+ """
+
+ value: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {}
+ if self.value is not None:
+ data["value"] = self.value
+ return data
+
+
+class ScheduleType(str, Enum):
+ """Schedule types for Chronicle SOAR integration job
+ instance advanced config."""
+
+ UNSPECIFIED = "SCHEDULE_TYPE_UNSPECIFIED"
+ ONCE = "ONCE"
+ DAILY = "DAILY"
+ WEEKLY = "WEEKLY"
+ MONTHLY = "MONTHLY"
+
+
+class DayOfWeek(str, Enum):
+ """Days of the week for Chronicle SOAR weekly schedule details."""
+
+ UNSPECIFIED = "DAY_OF_WEEK_UNSPECIFIED"
+ MONDAY = "MONDAY"
+ TUESDAY = "TUESDAY"
+ WEDNESDAY = "WEDNESDAY"
+ THURSDAY = "THURSDAY"
+ FRIDAY = "FRIDAY"
+ SATURDAY = "SATURDAY"
+ SUNDAY = "SUNDAY"
+
+
+@dataclass
+class Date:
+ """A calendar date for Chronicle SOAR schedule details.
+
+ Attributes:
+ year: The year.
+ month: The month of the year (1-12).
+ day: The day of the month (1-31).
+ """
+
+ year: int
+ month: int
+ day: int
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {"year": self.year, "month": self.month, "day": self.day}
+
+
+@dataclass
+class TimeOfDay:
+ """A time of day for Chronicle SOAR schedule details.
+
+ Attributes:
+ hours: The hour of the day (0-23).
+ minutes: The minute of the hour (0-59).
+ seconds: The second of the minute (0-59).
+ nanos: The nanoseconds of the second (0-999999999).
+ """
+
+ hours: int
+ minutes: int
+ seconds: int = 0
+ nanos: int = 0
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "hours": self.hours,
+ "minutes": self.minutes,
+ "seconds": self.seconds,
+ "nanos": self.nanos,
+ }
+
+
+@dataclass
+class OneTimeScheduleDetails:
+ """One-time schedule details for a Chronicle SOAR job instance.
+
+ Attributes:
+ start_date: The date to run the job.
+ time: The time to run the job.
+ """
+
+ start_date: Date
+ time: TimeOfDay
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "startDate": self.start_date.to_dict(),
+ "time": self.time.to_dict(),
+ }
+
+
+@dataclass
+class DailyScheduleDetails:
+ """Daily schedule details for a Chronicle SOAR job instance.
+
+ Attributes:
+ start_date: The start date.
+ time: The time to run the job.
+ interval: The day interval.
+ """
+
+ start_date: Date
+ time: TimeOfDay
+ interval: int
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "startDate": self.start_date.to_dict(),
+ "time": self.time.to_dict(),
+ "interval": self.interval,
+ }
+
+
+@dataclass
+class WeeklyScheduleDetails:
+ """Weekly schedule details for a Chronicle SOAR job instance.
+
+ Attributes:
+ start_date: The start date.
+ days: The days of the week to run the job.
+ time: The time to run the job.
+ interval: The week interval.
+ """
+
+ start_date: Date
+ days: list[DayOfWeek]
+ time: TimeOfDay
+ interval: int
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "startDate": self.start_date.to_dict(),
+ "days": [d.value for d in self.days],
+ "time": self.time.to_dict(),
+ "interval": self.interval,
+ }
+
+
+@dataclass
+class MonthlyScheduleDetails:
+ """Monthly schedule details for a Chronicle SOAR job instance.
+
+ Attributes:
+ start_date: The start date.
+ day: The day of the month to run the job.
+ time: The time to run the job.
+ interval: The month interval.
+ """
+
+ start_date: Date
+ day: int
+ time: TimeOfDay
+ interval: int
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "startDate": self.start_date.to_dict(),
+ "day": self.day,
+ "time": self.time.to_dict(),
+ "interval": self.interval,
+ }
+
+
+@dataclass
+class AdvancedConfig:
+ """Advanced scheduling configuration for a Chronicle SOAR job instance.
+
+ Exactly one of the schedule detail fields should be provided, corresponding
+ to the schedule_type.
+
+ Attributes:
+ time_zone: The zone id.
+ schedule_type: The schedule type.
+ one_time_schedule: One-time schedule details. Use with ONCE.
+ daily_schedule: Daily schedule details. Use with DAILY.
+ weekly_schedule: Weekly schedule details. Use with WEEKLY.
+ monthly_schedule: Monthly schedule details. Use with MONTHLY.
+ """
+
+ time_zone: str
+ schedule_type: ScheduleType
+ one_time_schedule: OneTimeScheduleDetails | None = None
+ daily_schedule: DailyScheduleDetails | None = None
+ weekly_schedule: WeeklyScheduleDetails | None = None
+ monthly_schedule: MonthlyScheduleDetails | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "timeZone": self.time_zone,
+ "scheduleType": str(self.schedule_type.value),
+ }
+ if self.one_time_schedule is not None:
+ data["oneTimeSchedule"] = self.one_time_schedule.to_dict()
+ if self.daily_schedule is not None:
+ data["dailySchedule"] = self.daily_schedule.to_dict()
+ if self.weekly_schedule is not None:
+ data["weeklySchedule"] = self.weekly_schedule.to_dict()
+ if self.monthly_schedule is not None:
+ data["monthlySchedule"] = self.monthly_schedule.to_dict()
+ return data
+
+
+@dataclass
+class JobParameter:
+ """A parameter definition for a Chronicle SOAR integration job.
+
+ Attributes:
+ id: The parameter's id.
+ display_name: The parameter's display name.
+ description: The parameter's description.
+ mandatory: Whether the parameter is mandatory.
+ type: The parameter's type.
+ default_value: The default value of the parameter.
+ """
+
+ id: int
+ display_name: str
+ description: str
+ mandatory: bool
+ type: ParamType
+ default_value: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "id": self.id,
+ "displayName": self.display_name,
+ "description": self.description,
+ "mandatory": self.mandatory,
+ "type": str(self.type.value),
+ }
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ return data
+
+
+class IntegrationParameterType(str, Enum):
+ """Parameter types for Chronicle SOAR integration instances."""
+
+ UNSPECIFIED = "INTEGRATION_PARAMETER_TYPE_UNSPECIFIED"
+ BOOLEAN = "BOOLEAN"
+ INT = "INT"
+ STRING = "STRING"
+ PASSWORD = "PASSWORD"
+ IP = "IP"
+ IP_OR_HOST = "IP_OR_HOST"
+ URL = "URL"
+ DOMAIN = "DOMAIN"
+ EMAIL = "EMAIL"
+ VALUES_LIST = "VALUES_LIST"
+ VALUES_AS_SEMICOLON_SEPARATED_STRING = (
+ "VALUES_AS_SEMICOLON_SEPARATED_STRING"
+ )
+ MULTI_VALUES_SELECTION = "MULTI_VALUES_SELECTION"
+ SCRIPT = "SCRIPT"
+ FILTER_LIST = "FILTER_LIST"
+
+
+@dataclass
+class IntegrationInstanceParameter:
+ """A parameter instance for a Chronicle SOAR integration instance.
+
+ Note: Most fields are output-only and will be populated by the API.
+ Only value needs to be provided when configuring an integration instance.
+
+ Attributes:
+ value: The parameter's value.
+ """
+
+ value: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {}
+ if self.value is not None:
+ data["value"] = self.value
+ return data
+
+
+class ConnectorConnectivityStatus(str, Enum):
+ """Connectivity status for Chronicle SOAR connector instances."""
+
+ LIVE = "LIVE"
+ NOT_LIVE = "NOT_LIVE"
+
+
+@dataclass
+class ConnectorInstanceParameter:
+ """A parameter instance for a Chronicle SOAR connector instance.
+
+ Note: Most fields are output-only and will be populated by the API.
+ Only value needs to be provided when configuring a connector instance.
+
+ Attributes:
+ value: The value of the parameter.
+ """
+
+ value: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {}
+ if self.value is not None:
+ data["value"] = self.value
+ return data
+
+
+class TransformerType(str, Enum):
+ """Transformer types for Chronicle SOAR integration transformers."""
+
+ UNSPECIFIED = "TRANSFORMER_TYPE_UNSPECIFIED"
+ BUILT_IN = "BUILT_IN"
+ CUSTOM = "CUSTOM"
+
+
+@dataclass
+class TransformerDefinitionParameter:
+ """A parameter definition for a Chronicle SOAR transformer definition.
+
+ Attributes:
+ display_name: The parameter's display name. May contain letters,
+ numbers, and underscores. Maximum 150 characters.
+ mandatory: Whether the parameter is mandatory for configuring a
+ transformer instance.
+ id: The parameter's id. Server-generated on creation; must be
+ provided when updating an existing parameter.
+ default_value: The default value of the parameter. Required for
+ boolean and mandatory parameters.
+ description: The parameter's description. Maximum 2050 characters.
+ """
+
+ display_name: str
+ mandatory: bool
+ id: str | None = None
+ default_value: str | None = None
+ description: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "displayName": self.display_name,
+ "mandatory": self.mandatory,
+ }
+ if self.id is not None:
+ data["id"] = self.id
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ if self.description is not None:
+ data["description"] = self.description
+ return data
+
+
+class LogicalOperatorType(str, Enum):
+ """Logical operator types for Chronicle SOAR
+ integration logical operators."""
+
+ UNSPECIFIED = "LOGICAL_OPERATOR_TYPE_UNSPECIFIED"
+ BUILT_IN = "BUILT_IN"
+ CUSTOM = "CUSTOM"
+
+
+@dataclass
+class IntegrationLogicalOperatorParameter:
+ """A parameter definition for a Chronicle SOAR logical operator.
+
+ Attributes:
+ display_name: The parameter's display name. May contain letters,
+ numbers, and underscores. Maximum 150 characters.
+ mandatory: Whether the parameter is mandatory for configuring a
+ logical operator instance.
+ id: The parameter's id. Server-generated on creation; must be
+ provided when updating an existing parameter.
+ default_value: The default value of the parameter. Required for
+ boolean and mandatory parameters.
+ order: The parameter's order in the parameters list.
+ description: The parameter's description. Maximum 2050 characters.
+ """
+
+ display_name: str
+ mandatory: bool
+ id: str | None = None
+ default_value: str | None = None
+ order: int | None = None
+ description: str | None = None
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ data: dict = {
+ "displayName": self.display_name,
+ "mandatory": self.mandatory,
+ }
+ if self.id is not None:
+ data["id"] = self.id
+ if self.default_value is not None:
+ data["defaultValue"] = self.default_value
+ if self.order is not None:
+ data["order"] = self.order
+ if self.description is not None:
+ data["description"] = self.description
+ return data
+
+
+@dataclass
+class ConnectorRule:
+ """A rule definition for a Chronicle SOAR integration connector.
+
+ Attributes:
+ display_name: Connector's rule data name.
+ type: Connector's rule data type.
+ """
+
+ display_name: str
+ type: ConnectorRuleType
+
+ def to_dict(self) -> dict:
+ """Serialize to the dict shape expected by the Chronicle API."""
+ return {
+ "displayName": self.display_name,
+ "type": str(self.type.value),
+ }
+
+
@dataclass
class TimeInterval:
"""Time interval with start and end times."""
diff --git a/src/secops/chronicle/stats.py b/src/secops/chronicle/stats.py
index 99b46309..42e31aba 100644
--- a/src/secops/chronicle/stats.py
+++ b/src/secops/chronicle/stats.py
@@ -13,6 +13,7 @@
# limitations under the License.
#
"""Statistics functionality for Chronicle searches."""
+
from datetime import datetime
from typing import Any, TYPE_CHECKING
diff --git a/src/secops/chronicle/utils/format_utils.py b/src/secops/chronicle/utils/format_utils.py
index b6567528..126ae503 100644
--- a/src/secops/chronicle/utils/format_utils.py
+++ b/src/secops/chronicle/utils/format_utils.py
@@ -65,3 +65,34 @@ def parse_json_list(
except ValueError as e:
raise APIError(f"Invalid {field_name} JSON") from e
return value
+
+
+# pylint: disable=line-too-long
+def build_patch_body(
+ field_map: list[tuple[str, str, Any]],
+ update_mask: str | None = None,
+) -> tuple[dict[str, Any], dict[str, Any] | None]:
+ """Build a request body and params dict for a PATCH request.
+
+ Args:
+ field_map: List of (api_key, mask_key, value) tuples for
+ each optional field.
+ update_mask: Explicit update mask. If provided,
+ overrides the auto-generated mask.
+
+ Returns:
+ Tuple of (body, params) where params contains the updateMask or is None.
+ """
+ body = {
+ api_key: value for api_key, _, value in field_map if value is not None
+ }
+ mask_fields = [
+ mask_key for _, mask_key, value in field_map if value is not None
+ ]
+
+ resolved_mask = update_mask or (
+ ",".join(mask_fields) if mask_fields else None
+ )
+ params = {"updateMask": resolved_mask} if resolved_mask else None
+
+ return body, params
diff --git a/src/secops/chronicle/utils/request_utils.py b/src/secops/chronicle/utils/request_utils.py
index 43f2d885..c3b2cd8a 100644
--- a/src/secops/chronicle/utils/request_utils.py
+++ b/src/secops/chronicle/utils/request_utils.py
@@ -14,7 +14,7 @@
#
"""Helper functions for Chronicle."""
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, Optional
import requests
from google.auth.exceptions import GoogleAuthError
@@ -297,3 +297,66 @@ def chronicle_request(
)
return data
+
+
+def chronicle_request_bytes(
+ client: "ChronicleClient",
+ method: str,
+ endpoint_path: str,
+ *,
+ api_version: str = APIVersion.V1,
+ params: Optional[dict[str, Any]] = None,
+ headers: Optional[dict[str, Any]] = None,
+ expected_status: int | set[int] | tuple[int, ...] | list[int] = 200,
+ error_message: str | None = None,
+ timeout: int | None = None,
+) -> bytes:
+ base = f"{client.base_url(api_version)}/{client.instance_id}"
+
+ if endpoint_path.startswith(":"):
+ url = f"{base}{endpoint_path}"
+ else:
+ url = f'{base}/{endpoint_path.lstrip("/")}'
+
+ try:
+ response = client.session.request(
+ method=method,
+ url=url,
+ params=params,
+ headers=headers,
+ timeout=timeout,
+ stream=True,
+ )
+ except GoogleAuthError as exc:
+ base_msg = error_message or "Google authentication failed"
+ raise APIError(f"{base_msg}: authentication_error={exc}") from exc
+ except requests.RequestException as exc:
+ base_msg = error_message or "API request failed"
+ raise APIError(
+ f"{base_msg}: method={method}, url={url}, "
+ f"request_error={exc.__class__.__name__}, detail={exc}"
+ ) from exc
+
+ if isinstance(expected_status, (set, tuple, list)):
+ status_ok = response.status_code in expected_status
+ else:
+ status_ok = response.status_code == expected_status
+
+ if not status_ok:
+ # try json for detail, else preview text
+ try:
+ data = response.json()
+ raise APIError(
+ f"{error_message or 'API request failed'}: method={method}, url={url}, "
+ f"status={response.status_code}, response={data}"
+ ) from None
+ except ValueError:
+ preview = _safe_body_preview(
+ getattr(response, "text", ""), limit=MAX_BODY_CHARS
+ )
+ raise APIError(
+ f"{error_message or 'API request failed'}: method={method}, url={url}, "
+ f"status={response.status_code}, response_text={preview}"
+ ) from None
+
+ return response.content
diff --git a/src/secops/cli/cli_client.py b/src/secops/cli/cli_client.py
index 4c483656..65b787f2 100644
--- a/src/secops/cli/cli_client.py
+++ b/src/secops/cli/cli_client.py
@@ -39,6 +39,9 @@
from secops.cli.commands.udm_search import setup_udm_search_view_command
from secops.cli.commands.watchlist import setup_watchlist_command
from secops.cli.commands.rule_retrohunt import setup_rule_retrohunt_command
+from secops.cli.commands.integration.integration_client import (
+ setup_integrations_command,
+)
from secops.cli.utils.common_args import add_chronicle_args, add_common_args
from secops.cli.utils.config_utils import load_config
from secops.exceptions import AuthenticationError, SecOpsError
@@ -189,6 +192,7 @@ def build_parser() -> argparse.ArgumentParser:
setup_dashboard_query_command(subparsers)
setup_watchlist_command(subparsers)
setup_rule_retrohunt_command(subparsers)
+ setup_integrations_command(subparsers)
return parser
diff --git a/src/secops/cli/commands/__init__.py b/src/secops/cli/commands/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/secops/cli/commands/integration/__init__.py b/src/secops/cli/commands/integration/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/secops/cli/commands/integration/integration_client.py b/src/secops/cli/commands/integration/integration_client.py
new file mode 100644
index 00000000..909c4352
--- /dev/null
+++ b/src/secops/cli/commands/integration/integration_client.py
@@ -0,0 +1,38 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Top level arguments for integration commands"""
+
+from secops.cli.commands.integration import (
+ transformers,
+ transformer_revisions,
+ logical_operators,
+ logical_operator_revisions,
+)
+
+
+def setup_integrations_command(subparsers):
+ """Setup integration command"""
+ integrations_parser = subparsers.add_parser(
+ "integration", help="Manage SecOps integrations"
+ )
+ lvl1 = integrations_parser.add_subparsers(
+ dest="integrations_command", help="Integrations command"
+ )
+
+ # Setup all subcommands under `integration`
+ transformers.setup_transformers_command(lvl1)
+ transformer_revisions.setup_transformer_revisions_command(lvl1)
+ logical_operators.setup_logical_operators_command(lvl1)
+ logical_operator_revisions.setup_logical_operator_revisions_command(lvl1)
diff --git a/src/secops/cli/commands/integration/logical_operator_revisions.py b/src/secops/cli/commands/integration/logical_operator_revisions.py
new file mode 100644
index 00000000..d09b9d70
--- /dev/null
+++ b/src/secops/cli/commands/integration/logical_operator_revisions.py
@@ -0,0 +1,239 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Google SecOps CLI integration logical operator revisions commands"""
+
+import sys
+
+from secops.cli.utils.formatters import output_formatter
+from secops.cli.utils.common_args import (
+ add_pagination_args,
+ add_as_list_arg,
+)
+
+
+def setup_logical_operator_revisions_command(subparsers):
+ """Setup integration logical operator revisions command"""
+ revisions_parser = subparsers.add_parser(
+ "logical-operator-revisions",
+ help="Manage integration logical operator revisions",
+ )
+ lvl1 = revisions_parser.add_subparsers(
+ dest="logical_operator_revisions_command",
+ help="Integration logical operator revisions command",
+ )
+
+ # list command
+ list_parser = lvl1.add_parser(
+ "list",
+ help="List integration logical operator revisions",
+ )
+ list_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ list_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator",
+ dest="logical_operator_id",
+ required=True,
+ )
+ add_pagination_args(list_parser)
+ add_as_list_arg(list_parser)
+ list_parser.add_argument(
+ "--filter-string",
+ type=str,
+ help="Filter string for listing revisions",
+ dest="filter_string",
+ )
+ list_parser.add_argument(
+ "--order-by",
+ type=str,
+ help="Order by string for listing revisions",
+ dest="order_by",
+ )
+ list_parser.set_defaults(
+ func=handle_logical_operator_revisions_list_command,
+ )
+
+ # delete command
+ delete_parser = lvl1.add_parser(
+ "delete",
+ help="Delete an integration logical operator revision",
+ )
+ delete_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator",
+ dest="logical_operator_id",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--revision-id",
+ type=str,
+ help="ID of the revision to delete",
+ dest="revision_id",
+ required=True,
+ )
+ delete_parser.set_defaults(
+ func=handle_logical_operator_revisions_delete_command,
+ )
+
+ # create command
+ create_parser = lvl1.add_parser(
+ "create",
+ help="Create a new integration logical operator revision",
+ )
+ create_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator",
+ dest="logical_operator_id",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--comment",
+ type=str,
+ help="Comment describing the revision",
+ dest="comment",
+ )
+ create_parser.set_defaults(
+ func=handle_logical_operator_revisions_create_command,
+ )
+
+ # rollback command
+ rollback_parser = lvl1.add_parser(
+ "rollback",
+ help="Rollback logical operator to a previous revision",
+ )
+ rollback_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ rollback_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator",
+ dest="logical_operator_id",
+ required=True,
+ )
+ rollback_parser.add_argument(
+ "--revision-id",
+ type=str,
+ help="ID of the revision to rollback to",
+ dest="revision_id",
+ required=True,
+ )
+ rollback_parser.set_defaults(
+ func=handle_logical_operator_revisions_rollback_command,
+ )
+
+
+def handle_logical_operator_revisions_list_command(args, chronicle):
+ """Handle integration logical operator revisions list command"""
+ try:
+ out = chronicle.list_integration_logical_operator_revisions(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ page_size=args.page_size,
+ page_token=args.page_token,
+ filter_string=args.filter_string,
+ order_by=args.order_by,
+ as_list=args.as_list,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error listing logical operator revisions: {e}", file=sys.stderr)
+ sys.exit(1)
+
+
+def handle_logical_operator_revisions_delete_command(args, chronicle):
+ """Handle integration logical operator revision delete command"""
+ try:
+ chronicle.delete_integration_logical_operator_revision(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ revision_id=args.revision_id,
+ )
+ print(
+ f"Logical operator revision {args.revision_id} deleted successfully"
+ )
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error deleting logical operator revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_logical_operator_revisions_create_command(args, chronicle):
+ """Handle integration logical operator revision create command"""
+ try:
+ # Get the current logical operator to create a revision
+ logical_operator = chronicle.get_integration_logical_operator(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ )
+ out = chronicle.create_integration_logical_operator_revision(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ logical_operator=logical_operator,
+ comment=args.comment,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error creating logical operator revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_logical_operator_revisions_rollback_command(args, chronicle):
+ """Handle integration logical operator revision rollback command"""
+ try:
+ out = chronicle.rollback_integration_logical_operator_revision(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ revision_id=args.revision_id,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error rolling back logical operator revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
diff --git a/src/secops/cli/commands/integration/logical_operators.py b/src/secops/cli/commands/integration/logical_operators.py
new file mode 100644
index 00000000..0bf65725
--- /dev/null
+++ b/src/secops/cli/commands/integration/logical_operators.py
@@ -0,0 +1,395 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Google SecOps CLI integration logical operators commands"""
+
+import sys
+
+from secops.cli.utils.formatters import output_formatter
+from secops.cli.utils.common_args import (
+ add_pagination_args,
+ add_as_list_arg,
+)
+
+
+def setup_logical_operators_command(subparsers):
+ """Setup integration logical operators command"""
+ operators_parser = subparsers.add_parser(
+ "logical-operators",
+ help="Manage integration logical operators",
+ )
+ lvl1 = operators_parser.add_subparsers(
+ dest="logical_operators_command",
+ help="Integration logical operators command",
+ )
+
+ # list command
+ list_parser = lvl1.add_parser(
+ "list",
+ help="List integration logical operators",
+ )
+ list_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ add_pagination_args(list_parser)
+ add_as_list_arg(list_parser)
+ list_parser.add_argument(
+ "--filter-string",
+ type=str,
+ help="Filter string for listing logical operators",
+ dest="filter_string",
+ )
+ list_parser.add_argument(
+ "--order-by",
+ type=str,
+ help="Order by string for listing logical operators",
+ dest="order_by",
+ )
+ list_parser.add_argument(
+ "--exclude-staging",
+ action="store_true",
+ help="Exclude staging logical operators from the response",
+ dest="exclude_staging",
+ )
+ list_parser.add_argument(
+ "--expand",
+ type=str,
+ help="Expand the response with full logical operator details",
+ dest="expand",
+ )
+ list_parser.set_defaults(func=handle_logical_operators_list_command)
+
+ # get command
+ get_parser = lvl1.add_parser(
+ "get",
+ help="Get integration logical operator details",
+ )
+ get_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ get_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator to get",
+ dest="logical_operator_id",
+ required=True,
+ )
+ get_parser.add_argument(
+ "--expand",
+ type=str,
+ help="Expand the response with full logical operator details",
+ dest="expand",
+ )
+ get_parser.set_defaults(func=handle_logical_operators_get_command)
+
+ # delete command
+ delete_parser = lvl1.add_parser(
+ "delete",
+ help="Delete an integration logical operator",
+ )
+ delete_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator to delete",
+ dest="logical_operator_id",
+ required=True,
+ )
+ delete_parser.set_defaults(func=handle_logical_operators_delete_command)
+
+ # create command
+ create_parser = lvl1.add_parser(
+ "create",
+ help="Create a new integration logical operator",
+ )
+ create_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--display-name",
+ type=str,
+ help="Display name for the logical operator",
+ dest="display_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--script",
+ type=str,
+ help="Python script for the logical operator",
+ dest="script",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--script-timeout",
+ type=str,
+ help="Timeout for script execution (e.g., '60s')",
+ dest="script_timeout",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--enabled",
+ action="store_true",
+ help="Enable the logical operator (default: disabled)",
+ dest="enabled",
+ )
+ create_parser.add_argument(
+ "--description",
+ type=str,
+ help="Description of the logical operator",
+ dest="description",
+ )
+ create_parser.set_defaults(func=handle_logical_operators_create_command)
+
+ # update command
+ update_parser = lvl1.add_parser(
+ "update",
+ help="Update an integration logical operator",
+ )
+ update_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ update_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator to update",
+ dest="logical_operator_id",
+ required=True,
+ )
+ update_parser.add_argument(
+ "--display-name",
+ type=str,
+ help="New display name for the logical operator",
+ dest="display_name",
+ )
+ update_parser.add_argument(
+ "--script",
+ type=str,
+ help="New Python script for the logical operator",
+ dest="script",
+ )
+ update_parser.add_argument(
+ "--script-timeout",
+ type=str,
+ help="New timeout for script execution",
+ dest="script_timeout",
+ )
+ update_parser.add_argument(
+ "--enabled",
+ type=lambda x: x.lower() == "true",
+ help="Enable or disable the logical operator (true/false)",
+ dest="enabled",
+ )
+ update_parser.add_argument(
+ "--description",
+ type=str,
+ help="New description for the logical operator",
+ dest="description",
+ )
+ update_parser.add_argument(
+ "--update-mask",
+ type=str,
+ help="Comma-separated list of fields to update",
+ dest="update_mask",
+ )
+ update_parser.set_defaults(func=handle_logical_operators_update_command)
+
+ # test command
+ test_parser = lvl1.add_parser(
+ "test",
+ help="Execute an integration logical operator test",
+ )
+ test_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ test_parser.add_argument(
+ "--logical-operator-id",
+ type=str,
+ help="ID of the logical operator to test",
+ dest="logical_operator_id",
+ required=True,
+ )
+ test_parser.set_defaults(func=handle_logical_operators_test_command)
+
+ # template command
+ template_parser = lvl1.add_parser(
+ "template",
+ help="Get logical operator template",
+ )
+ template_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ template_parser.set_defaults(func=handle_logical_operators_template_command)
+
+
+def handle_logical_operators_list_command(args, chronicle):
+ """Handle integration logical operators list command"""
+ try:
+ out = chronicle.list_integration_logical_operators(
+ integration_name=args.integration_name,
+ page_size=args.page_size,
+ page_token=args.page_token,
+ filter_string=args.filter_string,
+ order_by=args.order_by,
+ exclude_staging=args.exclude_staging,
+ expand=args.expand,
+ as_list=args.as_list,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error listing integration logical operators: {e}", file=sys.stderr
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_get_command(args, chronicle):
+ """Handle integration logical operator get command"""
+ try:
+ out = chronicle.get_integration_logical_operator(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ expand=args.expand,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error getting integration logical operator: {e}", file=sys.stderr
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_delete_command(args, chronicle):
+ """Handle integration logical operator delete command"""
+ try:
+ chronicle.delete_integration_logical_operator(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ )
+ print(
+ f"Logical operator {args.logical_operator_id} deleted successfully"
+ )
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error deleting integration logical operator: {e}", file=sys.stderr
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_create_command(args, chronicle):
+ """Handle integration logical operator create command"""
+ try:
+ out = chronicle.create_integration_logical_operator(
+ integration_name=args.integration_name,
+ display_name=args.display_name,
+ script=args.script,
+ script_timeout=args.script_timeout,
+ enabled=args.enabled,
+ description=args.description,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error creating integration logical operator: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_update_command(args, chronicle):
+ """Handle integration logical operator update command"""
+ try:
+ out = chronicle.update_integration_logical_operator(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ display_name=args.display_name,
+ script=args.script,
+ script_timeout=args.script_timeout,
+ enabled=args.enabled,
+ description=args.description,
+ update_mask=args.update_mask,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error updating integration logical operator: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_test_command(args, chronicle):
+ """Handle integration logical operator test command"""
+ try:
+ # Get the logical operator first
+ logical_operator = chronicle.get_integration_logical_operator(
+ integration_name=args.integration_name,
+ logical_operator_id=args.logical_operator_id,
+ )
+
+ out = chronicle.execute_integration_logical_operator_test(
+ integration_name=args.integration_name,
+ logical_operator=logical_operator,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error testing integration logical operator: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_logical_operators_template_command(args, chronicle):
+ """Handle integration logical operator template command"""
+ try:
+ out = chronicle.get_integration_logical_operator_template(
+ integration_name=args.integration_name,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error getting logical operator template: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
diff --git a/src/secops/cli/commands/integration/transformer_revisions.py b/src/secops/cli/commands/integration/transformer_revisions.py
new file mode 100644
index 00000000..1075a696
--- /dev/null
+++ b/src/secops/cli/commands/integration/transformer_revisions.py
@@ -0,0 +1,236 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Google SecOps CLI integration transformer revisions commands"""
+
+import sys
+
+from secops.cli.utils.formatters import output_formatter
+from secops.cli.utils.common_args import (
+ add_pagination_args,
+ add_as_list_arg,
+)
+
+
+def setup_transformer_revisions_command(subparsers):
+ """Setup integration transformer revisions command"""
+ revisions_parser = subparsers.add_parser(
+ "transformer-revisions",
+ help="Manage integration transformer revisions",
+ )
+ lvl1 = revisions_parser.add_subparsers(
+ dest="transformer_revisions_command",
+ help="Integration transformer revisions command",
+ )
+
+ # list command
+ list_parser = lvl1.add_parser(
+ "list",
+ help="List integration transformer revisions",
+ )
+ list_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ list_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer",
+ dest="transformer_id",
+ required=True,
+ )
+ add_pagination_args(list_parser)
+ add_as_list_arg(list_parser)
+ list_parser.add_argument(
+ "--filter-string",
+ type=str,
+ help="Filter string for listing revisions",
+ dest="filter_string",
+ )
+ list_parser.add_argument(
+ "--order-by",
+ type=str,
+ help="Order by string for listing revisions",
+ dest="order_by",
+ )
+ list_parser.set_defaults(
+ func=handle_transformer_revisions_list_command,
+ )
+
+ # delete command
+ delete_parser = lvl1.add_parser(
+ "delete",
+ help="Delete an integration transformer revision",
+ )
+ delete_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer",
+ dest="transformer_id",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--revision-id",
+ type=str,
+ help="ID of the revision to delete",
+ dest="revision_id",
+ required=True,
+ )
+ delete_parser.set_defaults(
+ func=handle_transformer_revisions_delete_command,
+ )
+
+ # create command
+ create_parser = lvl1.add_parser(
+ "create",
+ help="Create a new integration transformer revision",
+ )
+ create_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer",
+ dest="transformer_id",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--comment",
+ type=str,
+ help="Comment describing the revision",
+ dest="comment",
+ )
+ create_parser.set_defaults(
+ func=handle_transformer_revisions_create_command,
+ )
+
+ # rollback command
+ rollback_parser = lvl1.add_parser(
+ "rollback",
+ help="Rollback transformer to a previous revision",
+ )
+ rollback_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ rollback_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer",
+ dest="transformer_id",
+ required=True,
+ )
+ rollback_parser.add_argument(
+ "--revision-id",
+ type=str,
+ help="ID of the revision to rollback to",
+ dest="revision_id",
+ required=True,
+ )
+ rollback_parser.set_defaults(
+ func=handle_transformer_revisions_rollback_command,
+ )
+
+
+def handle_transformer_revisions_list_command(args, chronicle):
+ """Handle integration transformer revisions list command"""
+ try:
+ out = chronicle.list_integration_transformer_revisions(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ page_size=args.page_size,
+ page_token=args.page_token,
+ filter_string=args.filter_string,
+ order_by=args.order_by,
+ as_list=args.as_list,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error listing transformer revisions: {e}", file=sys.stderr)
+ sys.exit(1)
+
+
+def handle_transformer_revisions_delete_command(args, chronicle):
+ """Handle integration transformer revision delete command"""
+ try:
+ chronicle.delete_integration_transformer_revision(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ revision_id=args.revision_id,
+ )
+ print(f"Transformer revision {args.revision_id} deleted successfully")
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error deleting transformer revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_transformer_revisions_create_command(args, chronicle):
+ """Handle integration transformer revision create command"""
+ try:
+ # Get the current transformer to create a revision
+ transformer = chronicle.get_integration_transformer(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ )
+ out = chronicle.create_integration_transformer_revision(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ transformer=transformer,
+ comment=args.comment,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error creating transformer revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_transformer_revisions_rollback_command(args, chronicle):
+ """Handle integration transformer revision rollback command"""
+ try:
+ out = chronicle.rollback_integration_transformer_revision(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ revision_id=args.revision_id,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error rolling back transformer revision: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
diff --git a/src/secops/cli/commands/integration/transformers.py b/src/secops/cli/commands/integration/transformers.py
new file mode 100644
index 00000000..65dcd32d
--- /dev/null
+++ b/src/secops/cli/commands/integration/transformers.py
@@ -0,0 +1,387 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Google SecOps CLI integration transformers commands"""
+
+import sys
+
+from secops.cli.utils.formatters import output_formatter
+from secops.cli.utils.common_args import (
+ add_pagination_args,
+ add_as_list_arg,
+)
+
+
+def setup_transformers_command(subparsers):
+ """Setup integration transformers command"""
+ transformers_parser = subparsers.add_parser(
+ "transformers",
+ help="Manage integration transformers",
+ )
+ lvl1 = transformers_parser.add_subparsers(
+ dest="transformers_command",
+ help="Integration transformers command",
+ )
+
+ # list command
+ list_parser = lvl1.add_parser(
+ "list",
+ help="List integration transformers",
+ )
+ list_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ add_pagination_args(list_parser)
+ add_as_list_arg(list_parser)
+ list_parser.add_argument(
+ "--filter-string",
+ type=str,
+ help="Filter string for listing transformers",
+ dest="filter_string",
+ )
+ list_parser.add_argument(
+ "--order-by",
+ type=str,
+ help="Order by string for listing transformers",
+ dest="order_by",
+ )
+ list_parser.add_argument(
+ "--exclude-staging",
+ action="store_true",
+ help="Exclude staging transformers from the response",
+ dest="exclude_staging",
+ )
+ list_parser.add_argument(
+ "--expand",
+ type=str,
+ help="Expand the response with full transformer details",
+ dest="expand",
+ )
+ list_parser.set_defaults(func=handle_transformers_list_command)
+
+ # get command
+ get_parser = lvl1.add_parser(
+ "get",
+ help="Get integration transformer details",
+ )
+ get_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ get_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer to get",
+ dest="transformer_id",
+ required=True,
+ )
+ get_parser.add_argument(
+ "--expand",
+ type=str,
+ help="Expand the response with full transformer details",
+ dest="expand",
+ )
+ get_parser.set_defaults(func=handle_transformers_get_command)
+
+ # delete command
+ delete_parser = lvl1.add_parser(
+ "delete",
+ help="Delete an integration transformer",
+ )
+ delete_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ delete_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer to delete",
+ dest="transformer_id",
+ required=True,
+ )
+ delete_parser.set_defaults(func=handle_transformers_delete_command)
+
+ # create command
+ create_parser = lvl1.add_parser(
+ "create",
+ help="Create a new integration transformer",
+ )
+ create_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--display-name",
+ type=str,
+ help="Display name for the transformer",
+ dest="display_name",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--script",
+ type=str,
+ help="Python script for the transformer",
+ dest="script",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--script-timeout",
+ type=str,
+ help="Timeout for script execution (e.g., '60s')",
+ dest="script_timeout",
+ required=True,
+ )
+ create_parser.add_argument(
+ "--enabled",
+ action="store_true",
+ help="Enable the transformer (default: disabled)",
+ dest="enabled",
+ )
+ create_parser.add_argument(
+ "--description",
+ type=str,
+ help="Description of the transformer",
+ dest="description",
+ )
+ create_parser.set_defaults(func=handle_transformers_create_command)
+
+ # update command
+ update_parser = lvl1.add_parser(
+ "update",
+ help="Update an integration transformer",
+ )
+ update_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ update_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer to update",
+ dest="transformer_id",
+ required=True,
+ )
+ update_parser.add_argument(
+ "--display-name",
+ type=str,
+ help="New display name for the transformer",
+ dest="display_name",
+ )
+ update_parser.add_argument(
+ "--script",
+ type=str,
+ help="New Python script for the transformer",
+ dest="script",
+ )
+ update_parser.add_argument(
+ "--script-timeout",
+ type=str,
+ help="New timeout for script execution",
+ dest="script_timeout",
+ )
+ update_parser.add_argument(
+ "--enabled",
+ type=lambda x: x.lower() == "true",
+ help="Enable or disable the transformer (true/false)",
+ dest="enabled",
+ )
+ update_parser.add_argument(
+ "--description",
+ type=str,
+ help="New description for the transformer",
+ dest="description",
+ )
+ update_parser.add_argument(
+ "--update-mask",
+ type=str,
+ help="Comma-separated list of fields to update",
+ dest="update_mask",
+ )
+ update_parser.set_defaults(func=handle_transformers_update_command)
+
+ # test command
+ test_parser = lvl1.add_parser(
+ "test",
+ help="Execute an integration transformer test",
+ )
+ test_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ test_parser.add_argument(
+ "--transformer-id",
+ type=str,
+ help="ID of the transformer to test",
+ dest="transformer_id",
+ required=True,
+ )
+ test_parser.set_defaults(func=handle_transformers_test_command)
+
+ # template command
+ template_parser = lvl1.add_parser(
+ "template",
+ help="Get transformer template",
+ )
+ template_parser.add_argument(
+ "--integration-name",
+ type=str,
+ help="Name of the integration",
+ dest="integration_name",
+ required=True,
+ )
+ template_parser.set_defaults(func=handle_transformers_template_command)
+
+
+def handle_transformers_list_command(args, chronicle):
+ """Handle integration transformers list command"""
+ try:
+ out = chronicle.list_integration_transformers(
+ integration_name=args.integration_name,
+ page_size=args.page_size,
+ page_token=args.page_token,
+ filter_string=args.filter_string,
+ order_by=args.order_by,
+ exclude_staging=args.exclude_staging,
+ expand=args.expand,
+ as_list=args.as_list,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error listing integration transformers: {e}", file=sys.stderr)
+ sys.exit(1)
+
+
+def handle_transformers_get_command(args, chronicle):
+ """Handle integration transformer get command"""
+ try:
+ out = chronicle.get_integration_transformer(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ expand=args.expand,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error getting integration transformer: {e}", file=sys.stderr)
+ sys.exit(1)
+
+
+def handle_transformers_delete_command(args, chronicle):
+ """Handle integration transformer delete command"""
+ try:
+ chronicle.delete_integration_transformer(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ )
+ print(f"Transformer {args.transformer_id} deleted successfully")
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(f"Error deleting integration transformer: {e}", file=sys.stderr)
+ sys.exit(1)
+
+
+def handle_transformers_create_command(args, chronicle):
+ """Handle integration transformer create command"""
+ try:
+ out = chronicle.create_integration_transformer(
+ integration_name=args.integration_name,
+ display_name=args.display_name,
+ script=args.script,
+ script_timeout=args.script_timeout,
+ enabled=args.enabled,
+ description=args.description,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error creating integration transformer: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_transformers_update_command(args, chronicle):
+ """Handle integration transformer update command"""
+ try:
+ out = chronicle.update_integration_transformer(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ display_name=args.display_name,
+ script=args.script,
+ script_timeout=args.script_timeout,
+ enabled=args.enabled,
+ description=args.description,
+ update_mask=args.update_mask,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error updating integration transformer: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_transformers_test_command(args, chronicle):
+ """Handle integration transformer test command"""
+ try:
+ # Get the transformer first
+ transformer = chronicle.get_integration_transformer(
+ integration_name=args.integration_name,
+ transformer_id=args.transformer_id,
+ )
+
+ out = chronicle.execute_integration_transformer_test(
+ integration_name=args.integration_name,
+ transformer=transformer,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error testing integration transformer: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def handle_transformers_template_command(args, chronicle):
+ """Handle integration transformer template command"""
+ try:
+ out = chronicle.get_integration_transformer_template(
+ integration_name=args.integration_name,
+ )
+ output_formatter(out, getattr(args, "output", "json"))
+ except Exception as e: # pylint: disable=broad-exception-caught
+ print(
+ f"Error getting transformer template: {e}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
diff --git a/tests/chronicle/integration/__init__.py b/tests/chronicle/integration/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/chronicle/integration/test_logical_operator_revisions.py b/tests/chronicle/integration/test_logical_operator_revisions.py
new file mode 100644
index 00000000..29e912e6
--- /dev/null
+++ b/tests/chronicle/integration/test_logical_operator_revisions.py
@@ -0,0 +1,367 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Tests for Chronicle integration logical operator revisions functions."""
+
+from unittest.mock import Mock, patch
+
+import pytest
+
+from secops.chronicle.client import ChronicleClient
+from secops.chronicle.models import APIVersion
+from secops.chronicle.integration.logical_operator_revisions import (
+ list_integration_logical_operator_revisions,
+ delete_integration_logical_operator_revision,
+ create_integration_logical_operator_revision,
+ rollback_integration_logical_operator_revision,
+)
+from secops.exceptions import APIError
+
+
+@pytest.fixture
+def chronicle_client():
+ """Create a Chronicle client for testing."""
+ with patch("secops.auth.SecOpsAuth") as mock_auth:
+ mock_session = Mock()
+ mock_session.headers = {}
+ mock_auth.return_value.session = mock_session
+ return ChronicleClient(
+ customer_id="test-customer",
+ project_id="test-project",
+ default_api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- list_integration_logical_operator_revisions tests --
+
+
+def test_list_integration_logical_operator_revisions_success(chronicle_client):
+ """Test list_integration_logical_operator_revisions delegates to paginated request."""
+ expected = {
+ "revisions": [{"name": "r1"}, {"name": "r2"}],
+ "nextPageToken": "token",
+ }
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated, patch(
+ "secops.chronicle.integration.logical_operator_revisions.format_resource_id",
+ return_value="My Integration",
+ ):
+ result = list_integration_logical_operator_revisions(
+ chronicle_client,
+ integration_name="My Integration",
+ logical_operator_id="lo1",
+ page_size=10,
+ page_token="next-token",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/My Integration/logicalOperators/lo1/revisions",
+ items_key="revisions",
+ page_size=10,
+ page_token="next-token",
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_logical_operator_revisions_default_args(chronicle_client):
+ """Test list_integration_logical_operator_revisions with default args."""
+ expected = {"revisions": []}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_logical_operator_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/logicalOperators/lo1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_logical_operator_revisions_with_filter_order(
+ chronicle_client,
+):
+ """Test list passes filter/orderBy in extra_params."""
+ expected = {"revisions": [{"name": "r1"}]}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_logical_operator_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ filter_string='version = "1.0"',
+ order_by="createTime desc",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/logicalOperators/lo1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={
+ "filter": 'version = "1.0"',
+ "orderBy": "createTime desc",
+ },
+ as_list=False,
+ )
+
+
+def test_list_integration_logical_operator_revisions_as_list(chronicle_client):
+ """Test list_integration_logical_operator_revisions with as_list=True."""
+ expected = [{"name": "r1"}, {"name": "r2"}]
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_logical_operator_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ as_list=True,
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/logicalOperators/lo1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=True,
+ )
+
+
+# -- delete_integration_logical_operator_revision tests --
+
+
+def test_delete_integration_logical_operator_revision_success(chronicle_client):
+ """Test delete_integration_logical_operator_revision delegates to chronicle_request."""
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ return_value=None,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operator_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ delete_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ revision_id="rev1",
+ )
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="DELETE",
+ endpoint_path=(
+ "integrations/test-integration/logicalOperators/lo1/revisions/rev1"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- create_integration_logical_operator_revision tests --
+
+
+def test_create_integration_logical_operator_revision_minimal(chronicle_client):
+ """Test create_integration_logical_operator_revision with minimal fields."""
+ logical_operator = {
+ "displayName": "Test Operator",
+ "script": "def evaluate(a, b): return a == b",
+ }
+ expected = {"name": "rev1", "comment": ""}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operator_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = create_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path=(
+ "integrations/test-integration/logicalOperators/lo1/revisions"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ json={"logicalOperator": logical_operator},
+ )
+
+
+def test_create_integration_logical_operator_revision_with_comment(chronicle_client):
+ """Test create_integration_logical_operator_revision with comment."""
+ logical_operator = {
+ "displayName": "Test Operator",
+ "script": "def evaluate(a, b): return a == b",
+ }
+ expected = {"name": "rev1", "comment": "Version 2.0"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = create_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ comment="Version 2.0",
+ )
+
+ assert result == expected
+
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["json"]["logicalOperator"] == logical_operator
+ assert call_kwargs["json"]["comment"] == "Version 2.0"
+
+
+# -- rollback_integration_logical_operator_revision tests --
+
+
+def test_rollback_integration_logical_operator_revision_success(chronicle_client):
+ """Test rollback_integration_logical_operator_revision delegates to chronicle_request."""
+ expected = {"name": "rev1", "comment": "Rolled back"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operator_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = rollback_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ revision_id="rev1",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path=(
+ "integrations/test-integration/logicalOperators/lo1/"
+ "revisions/rev1:rollback"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- Error handling tests --
+
+
+def test_list_integration_logical_operator_revisions_api_error(chronicle_client):
+ """Test list_integration_logical_operator_revisions handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_paginated_request",
+ side_effect=APIError("API Error"),
+ ):
+ with pytest.raises(APIError, match="API Error"):
+ list_integration_logical_operator_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ )
+
+
+def test_delete_integration_logical_operator_revision_api_error(chronicle_client):
+ """Test delete_integration_logical_operator_revision handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ side_effect=APIError("Delete failed"),
+ ):
+ with pytest.raises(APIError, match="Delete failed"):
+ delete_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ revision_id="rev1",
+ )
+
+
+def test_create_integration_logical_operator_revision_api_error(chronicle_client):
+ """Test create_integration_logical_operator_revision handles API errors."""
+ logical_operator = {"displayName": "Test"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ side_effect=APIError("Creation failed"),
+ ):
+ with pytest.raises(APIError, match="Creation failed"):
+ create_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ logical_operator=logical_operator,
+ )
+
+
+def test_rollback_integration_logical_operator_revision_api_error(chronicle_client):
+ """Test rollback_integration_logical_operator_revision handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operator_revisions.chronicle_request",
+ side_effect=APIError("Rollback failed"),
+ ):
+ with pytest.raises(APIError, match="Rollback failed"):
+ rollback_integration_logical_operator_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ revision_id="rev1",
+ )
+
diff --git a/tests/chronicle/integration/test_logical_operators.py b/tests/chronicle/integration/test_logical_operators.py
new file mode 100644
index 00000000..df495750
--- /dev/null
+++ b/tests/chronicle/integration/test_logical_operators.py
@@ -0,0 +1,547 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Tests for Chronicle integration logical operators functions."""
+
+from unittest.mock import Mock, patch
+
+import pytest
+
+from secops.chronicle.client import ChronicleClient
+from secops.chronicle.models import APIVersion
+from secops.chronicle.integration.logical_operators import (
+ list_integration_logical_operators,
+ get_integration_logical_operator,
+ delete_integration_logical_operator,
+ create_integration_logical_operator,
+ update_integration_logical_operator,
+ execute_integration_logical_operator_test,
+ get_integration_logical_operator_template,
+)
+from secops.exceptions import APIError
+
+
+@pytest.fixture
+def chronicle_client():
+ """Create a Chronicle client for testing."""
+ with patch("secops.auth.SecOpsAuth") as mock_auth:
+ mock_session = Mock()
+ mock_session.headers = {}
+ mock_auth.return_value.session = mock_session
+ return ChronicleClient(
+ customer_id="test-customer",
+ project_id="test-project",
+ default_api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- list_integration_logical_operators tests --
+
+
+def test_list_integration_logical_operators_success(chronicle_client):
+ """Test list_integration_logical_operators delegates to paginated request."""
+ expected = {
+ "logicalOperators": [{"name": "lo1"}, {"name": "lo2"}],
+ "nextPageToken": "token",
+ }
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="My Integration",
+ ):
+ result = list_integration_logical_operators(
+ chronicle_client,
+ integration_name="My Integration",
+ page_size=10,
+ page_token="next-token",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/My Integration/logicalOperators",
+ items_key="logicalOperators",
+ page_size=10,
+ page_token="next-token",
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_logical_operators_default_args(chronicle_client):
+ """Test list_integration_logical_operators with default args."""
+ expected = {"logicalOperators": []}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_logical_operators(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/logicalOperators",
+ items_key="logicalOperators",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_logical_operators_with_filter_order_expand(
+ chronicle_client,
+):
+ """Test list passes filter/orderBy/excludeStaging/expand in extra_params."""
+ expected = {"logicalOperators": [{"name": "lo1"}]}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_logical_operators(
+ chronicle_client,
+ integration_name="test-integration",
+ filter_string='displayName = "My Operator"',
+ order_by="displayName",
+ exclude_staging=True,
+ expand="parameters",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/logicalOperators",
+ items_key="logicalOperators",
+ page_size=None,
+ page_token=None,
+ extra_params={
+ "filter": 'displayName = "My Operator"',
+ "orderBy": "displayName",
+ "excludeStaging": True,
+ "expand": "parameters",
+ },
+ as_list=False,
+ )
+
+
+# -- get_integration_logical_operator tests --
+
+
+def test_get_integration_logical_operator_success(chronicle_client):
+ """Test get_integration_logical_operator delegates to chronicle_request."""
+ expected = {"name": "lo1", "displayName": "My Operator"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = get_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path="integrations/test-integration/logicalOperators/lo1",
+ api_version=APIVersion.V1ALPHA,
+ params=None,
+ )
+
+
+def test_get_integration_logical_operator_with_expand(chronicle_client):
+ """Test get_integration_logical_operator with expand parameter."""
+ expected = {"name": "lo1"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = get_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ expand="parameters",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path="integrations/test-integration/logicalOperators/lo1",
+ api_version=APIVersion.V1ALPHA,
+ params={"expand": "parameters"},
+ )
+
+
+# -- delete_integration_logical_operator tests --
+
+
+def test_delete_integration_logical_operator_success(chronicle_client):
+ """Test delete_integration_logical_operator delegates to chronicle_request."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=None,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="test-integration",
+ ):
+ delete_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ )
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="DELETE",
+ endpoint_path="integrations/test-integration/logicalOperators/lo1",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- create_integration_logical_operator tests --
+
+
+def test_create_integration_logical_operator_minimal(chronicle_client):
+ """Test create_integration_logical_operator with minimal required fields."""
+ expected = {"name": "lo1", "displayName": "New Operator"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = create_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="New Operator",
+ script="def evaluate(a, b): return a == b",
+ script_timeout="60s",
+ enabled=True,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once()
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["method"] == "POST"
+ assert (
+ call_kwargs["endpoint_path"]
+ == "integrations/test-integration/logicalOperators"
+ )
+ assert call_kwargs["api_version"] == APIVersion.V1ALPHA
+ assert call_kwargs["json"]["displayName"] == "New Operator"
+ assert call_kwargs["json"]["script"] == "def evaluate(a, b): return a == b"
+ assert call_kwargs["json"]["scriptTimeout"] == "60s"
+ assert call_kwargs["json"]["enabled"] is True
+
+
+def test_create_integration_logical_operator_with_all_fields(chronicle_client):
+ """Test create_integration_logical_operator with all optional fields."""
+ expected = {"name": "lo1"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = create_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="Full Operator",
+ script="def evaluate(a, b): return a > b",
+ script_timeout="120s",
+ enabled=False,
+ description="Test logical operator description",
+ parameters=[{"name": "param1", "type": "STRING"}],
+ )
+
+ assert result == expected
+
+ call_kwargs = mock_request.call_args[1]
+ body = call_kwargs["json"]
+ assert body["displayName"] == "Full Operator"
+ assert body["description"] == "Test logical operator description"
+ assert body["parameters"] == [{"name": "param1", "type": "STRING"}]
+
+
+# -- update_integration_logical_operator tests --
+
+
+def test_update_integration_logical_operator_display_name(chronicle_client):
+ """Test update_integration_logical_operator updates display name."""
+ expected = {"name": "lo1", "displayName": "Updated Name"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.build_patch_body",
+ return_value=({"displayName": "Updated Name"}, {"updateMask": "displayName"}),
+ ) as mock_build:
+ result = update_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ display_name="Updated Name",
+ )
+
+ assert result == expected
+
+ mock_build.assert_called_once()
+ mock_request.assert_called_once()
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["method"] == "PATCH"
+ assert (
+ call_kwargs["endpoint_path"]
+ == "integrations/test-integration/logicalOperators/lo1"
+ )
+
+
+def test_update_integration_logical_operator_with_update_mask(chronicle_client):
+ """Test update_integration_logical_operator with explicit update mask."""
+ expected = {"name": "lo1"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.build_patch_body",
+ return_value=(
+ {"displayName": "New Name", "enabled": True},
+ {"updateMask": "displayName,enabled"},
+ ),
+ ):
+ result = update_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ display_name="New Name",
+ enabled=True,
+ update_mask="displayName,enabled",
+ )
+
+ assert result == expected
+
+
+def test_update_integration_logical_operator_all_fields(chronicle_client):
+ """Test update_integration_logical_operator with all fields."""
+ expected = {"name": "lo1"}
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.build_patch_body",
+ return_value=(
+ {
+ "displayName": "Updated",
+ "script": "new script",
+ "scriptTimeout": "90s",
+ "enabled": False,
+ "description": "Updated description",
+ "parameters": [{"name": "p1"}],
+ },
+ {"updateMask": "displayName,script,scriptTimeout,enabled,description"},
+ ),
+ ):
+ result = update_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ display_name="Updated",
+ script="new script",
+ script_timeout="90s",
+ enabled=False,
+ description="Updated description",
+ parameters=[{"name": "p1"}],
+ )
+
+ assert result == expected
+
+
+# -- execute_integration_logical_operator_test tests --
+
+
+def test_execute_integration_logical_operator_test_success(chronicle_client):
+ """Test execute_integration_logical_operator_test delegates to chronicle_request."""
+ logical_operator = {
+ "displayName": "Test Operator",
+ "script": "def evaluate(a, b): return a == b",
+ }
+ expected = {
+ "outputMessage": "Success",
+ "debugOutputMessage": "Debug info",
+ "resultValue": True,
+ }
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = execute_integration_logical_operator_test(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator=logical_operator,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path="integrations/test-integration/logicalOperators:executeTest",
+ api_version=APIVersion.V1ALPHA,
+ json={"logicalOperator": logical_operator},
+ )
+
+
+# -- get_integration_logical_operator_template tests --
+
+
+def test_get_integration_logical_operator_template_success(chronicle_client):
+ """Test get_integration_logical_operator_template delegates to chronicle_request."""
+ expected = {
+ "script": "def evaluate(a, b):\n # Template code\n return True",
+ "displayName": "Template Operator",
+ }
+
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.logical_operators.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = get_integration_logical_operator_template(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path=(
+ "integrations/test-integration/logicalOperators:fetchTemplate"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- Error handling tests --
+
+
+def test_list_integration_logical_operators_api_error(chronicle_client):
+ """Test list_integration_logical_operators handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_paginated_request",
+ side_effect=APIError("API Error"),
+ ):
+ with pytest.raises(APIError, match="API Error"):
+ list_integration_logical_operators(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+
+def test_get_integration_logical_operator_api_error(chronicle_client):
+ """Test get_integration_logical_operator handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ side_effect=APIError("Not found"),
+ ):
+ with pytest.raises(APIError, match="Not found"):
+ get_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="nonexistent",
+ )
+
+
+def test_create_integration_logical_operator_api_error(chronicle_client):
+ """Test create_integration_logical_operator handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ side_effect=APIError("Creation failed"),
+ ):
+ with pytest.raises(APIError, match="Creation failed"):
+ create_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="New Operator",
+ script="def evaluate(a, b): return a == b",
+ script_timeout="60s",
+ enabled=True,
+ )
+
+
+def test_update_integration_logical_operator_api_error(chronicle_client):
+ """Test update_integration_logical_operator handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ side_effect=APIError("Update failed"),
+ ), patch(
+ "secops.chronicle.integration.logical_operators.build_patch_body",
+ return_value=({"displayName": "Updated"}, {"updateMask": "displayName"}),
+ ):
+ with pytest.raises(APIError, match="Update failed"):
+ update_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ display_name="Updated",
+ )
+
+
+def test_delete_integration_logical_operator_api_error(chronicle_client):
+ """Test delete_integration_logical_operator handles API errors."""
+ with patch(
+ "secops.chronicle.integration.logical_operators.chronicle_request",
+ side_effect=APIError("Delete failed"),
+ ):
+ with pytest.raises(APIError, match="Delete failed"):
+ delete_integration_logical_operator(
+ chronicle_client,
+ integration_name="test-integration",
+ logical_operator_id="lo1",
+ )
+
diff --git a/tests/chronicle/integration/test_transformer_revisions.py b/tests/chronicle/integration/test_transformer_revisions.py
new file mode 100644
index 00000000..8107891e
--- /dev/null
+++ b/tests/chronicle/integration/test_transformer_revisions.py
@@ -0,0 +1,366 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Tests for Chronicle integration transformer revisions functions."""
+
+from unittest.mock import Mock, patch
+
+import pytest
+
+from secops.chronicle.client import ChronicleClient
+from secops.chronicle.models import APIVersion
+from secops.chronicle.integration.transformer_revisions import (
+ list_integration_transformer_revisions,
+ delete_integration_transformer_revision,
+ create_integration_transformer_revision,
+ rollback_integration_transformer_revision,
+)
+from secops.exceptions import APIError
+
+
+@pytest.fixture
+def chronicle_client():
+ """Create a Chronicle client for testing."""
+ with patch("secops.auth.SecOpsAuth") as mock_auth:
+ mock_session = Mock()
+ mock_session.headers = {}
+ mock_auth.return_value.session = mock_session
+ return ChronicleClient(
+ customer_id="test-customer",
+ project_id="test-project",
+ default_api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- list_integration_transformer_revisions tests --
+
+
+def test_list_integration_transformer_revisions_success(chronicle_client):
+ """Test list_integration_transformer_revisions delegates to paginated request."""
+ expected = {
+ "revisions": [{"name": "r1"}, {"name": "r2"}],
+ "nextPageToken": "token",
+ }
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated, patch(
+ "secops.chronicle.integration.transformer_revisions.format_resource_id",
+ return_value="My Integration",
+ ):
+ result = list_integration_transformer_revisions(
+ chronicle_client,
+ integration_name="My Integration",
+ transformer_id="t1",
+ page_size=10,
+ page_token="next-token",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/My Integration/transformers/t1/revisions",
+ items_key="revisions",
+ page_size=10,
+ page_token="next-token",
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_transformer_revisions_default_args(chronicle_client):
+ """Test list_integration_transformer_revisions with default args."""
+ expected = {"revisions": []}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_transformer_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/transformers/t1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_transformer_revisions_with_filter_order(
+ chronicle_client,
+):
+ """Test list passes filter/orderBy in extra_params."""
+ expected = {"revisions": [{"name": "r1"}]}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_transformer_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ filter_string='version = "1.0"',
+ order_by="createTime desc",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/transformers/t1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={
+ "filter": 'version = "1.0"',
+ "orderBy": "createTime desc",
+ },
+ as_list=False,
+ )
+
+
+def test_list_integration_transformer_revisions_as_list(chronicle_client):
+ """Test list_integration_transformer_revisions with as_list=True."""
+ expected = [{"name": "r1"}, {"name": "r2"}]
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_transformer_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ as_list=True,
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/transformers/t1/revisions",
+ items_key="revisions",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=True,
+ )
+
+
+# -- delete_integration_transformer_revision tests --
+
+
+def test_delete_integration_transformer_revision_success(chronicle_client):
+ """Test delete_integration_transformer_revision delegates to chronicle_request."""
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ return_value=None,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformer_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ delete_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ revision_id="rev1",
+ )
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="DELETE",
+ endpoint_path=(
+ "integrations/test-integration/transformers/t1/revisions/rev1"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- create_integration_transformer_revision tests --
+
+
+def test_create_integration_transformer_revision_minimal(chronicle_client):
+ """Test create_integration_transformer_revision with minimal fields."""
+ transformer = {
+ "displayName": "Test Transformer",
+ "script": "def transform(data): return data",
+ }
+ expected = {"name": "rev1", "comment": ""}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformer_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = create_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ transformer=transformer,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path=(
+ "integrations/test-integration/transformers/t1/revisions"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ json={"transformer": transformer},
+ )
+
+
+def test_create_integration_transformer_revision_with_comment(chronicle_client):
+ """Test create_integration_transformer_revision with comment."""
+ transformer = {
+ "displayName": "Test Transformer",
+ "script": "def transform(data): return data",
+ }
+ expected = {"name": "rev1", "comment": "Version 2.0"}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = create_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ transformer=transformer,
+ comment="Version 2.0",
+ )
+
+ assert result == expected
+
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["json"]["transformer"] == transformer
+ assert call_kwargs["json"]["comment"] == "Version 2.0"
+
+
+# -- rollback_integration_transformer_revision tests --
+
+
+def test_rollback_integration_transformer_revision_success(chronicle_client):
+ """Test rollback_integration_transformer_revision delegates to chronicle_request."""
+ expected = {"name": "rev1", "comment": "Rolled back"}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformer_revisions.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = rollback_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ revision_id="rev1",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path=(
+ "integrations/test-integration/transformers/t1/revisions/rev1:rollback"
+ ),
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- Error handling tests --
+
+
+def test_list_integration_transformer_revisions_api_error(chronicle_client):
+ """Test list_integration_transformer_revisions handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_paginated_request",
+ side_effect=APIError("API Error"),
+ ):
+ with pytest.raises(APIError, match="API Error"):
+ list_integration_transformer_revisions(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ )
+
+
+def test_delete_integration_transformer_revision_api_error(chronicle_client):
+ """Test delete_integration_transformer_revision handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ side_effect=APIError("Delete failed"),
+ ):
+ with pytest.raises(APIError, match="Delete failed"):
+ delete_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ revision_id="rev1",
+ )
+
+
+def test_create_integration_transformer_revision_api_error(chronicle_client):
+ """Test create_integration_transformer_revision handles API errors."""
+ transformer = {"displayName": "Test"}
+
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ side_effect=APIError("Creation failed"),
+ ):
+ with pytest.raises(APIError, match="Creation failed"):
+ create_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ transformer=transformer,
+ )
+
+
+def test_rollback_integration_transformer_revision_api_error(chronicle_client):
+ """Test rollback_integration_transformer_revision handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformer_revisions.chronicle_request",
+ side_effect=APIError("Rollback failed"),
+ ):
+ with pytest.raises(APIError, match="Rollback failed"):
+ rollback_integration_transformer_revision(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="t1",
+ revision_id="rev1",
+ )
+
diff --git a/tests/chronicle/integration/test_transformers.py b/tests/chronicle/integration/test_transformers.py
new file mode 100644
index 00000000..43d8687e
--- /dev/null
+++ b/tests/chronicle/integration/test_transformers.py
@@ -0,0 +1,555 @@
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""Tests for Chronicle integration transformers functions."""
+
+from unittest.mock import Mock, patch
+
+import pytest
+
+from secops.chronicle.client import ChronicleClient
+from secops.chronicle.models import APIVersion
+from secops.chronicle.integration.transformers import (
+ list_integration_transformers,
+ get_integration_transformer,
+ delete_integration_transformer,
+ create_integration_transformer,
+ update_integration_transformer,
+ execute_integration_transformer_test,
+ get_integration_transformer_template,
+)
+from secops.exceptions import APIError
+
+
+@pytest.fixture
+def chronicle_client():
+ """Create a Chronicle client for testing."""
+ with patch("secops.auth.SecOpsAuth") as mock_auth:
+ mock_session = Mock()
+ mock_session.headers = {}
+ mock_auth.return_value.session = mock_session
+ return ChronicleClient(
+ customer_id="test-customer",
+ project_id="test-project",
+ default_api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- list_integration_transformers tests --
+
+
+def test_list_integration_transformers_success(chronicle_client):
+ """Test list_integration_transformers delegates to chronicle_paginated_request."""
+ expected = {
+ "transformers": [{"name": "t1"}, {"name": "t2"}],
+ "nextPageToken": "token",
+ }
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="My Integration",
+ ):
+ result = list_integration_transformers(
+ chronicle_client,
+ integration_name="My Integration",
+ page_size=10,
+ page_token="next-token",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/My Integration/transformers",
+ items_key="transformers",
+ page_size=10,
+ page_token="next-token",
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_transformers_default_args(chronicle_client):
+ """Test list_integration_transformers with default args."""
+ expected = {"transformers": []}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_transformers(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/transformers",
+ items_key="transformers",
+ page_size=None,
+ page_token=None,
+ extra_params={},
+ as_list=False,
+ )
+
+
+def test_list_integration_transformers_with_filter_order_expand(chronicle_client):
+ """Test list passes filter/orderBy/excludeStaging/expand in extra_params."""
+ expected = {"transformers": [{"name": "t1"}]}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_paginated_request",
+ return_value=expected,
+ ) as mock_paginated:
+ result = list_integration_transformers(
+ chronicle_client,
+ integration_name="test-integration",
+ filter_string='displayName = "My Transformer"',
+ order_by="displayName",
+ exclude_staging=True,
+ expand="parameters",
+ )
+
+ assert result == expected
+
+ mock_paginated.assert_called_once_with(
+ chronicle_client,
+ api_version=APIVersion.V1ALPHA,
+ path="integrations/test-integration/transformers",
+ items_key="transformers",
+ page_size=None,
+ page_token=None,
+ extra_params={
+ "filter": 'displayName = "My Transformer"',
+ "orderBy": "displayName",
+ "excludeStaging": True,
+ "expand": "parameters",
+ },
+ as_list=False,
+ )
+
+
+# -- get_integration_transformer tests --
+
+
+def test_get_integration_transformer_success(chronicle_client):
+ """Test get_integration_transformer delegates to chronicle_request."""
+ expected = {"name": "transformer1", "displayName": "My Transformer"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = get_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path="integrations/test-integration/transformers/transformer1",
+ api_version=APIVersion.V1ALPHA,
+ params=None,
+ )
+
+
+def test_get_integration_transformer_with_expand(chronicle_client):
+ """Test get_integration_transformer with expand parameter."""
+ expected = {"name": "transformer1"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = get_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ expand="parameters",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path="integrations/test-integration/transformers/transformer1",
+ api_version=APIVersion.V1ALPHA,
+ params={"expand": "parameters"},
+ )
+
+
+# -- delete_integration_transformer tests --
+
+
+def test_delete_integration_transformer_success(chronicle_client):
+ """Test delete_integration_transformer delegates to chronicle_request."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=None,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="test-integration",
+ ):
+ delete_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ )
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="DELETE",
+ endpoint_path="integrations/test-integration/transformers/transformer1",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- create_integration_transformer tests --
+
+
+def test_create_integration_transformer_minimal(chronicle_client):
+ """Test create_integration_transformer with minimal required fields."""
+ expected = {"name": "transformer1", "displayName": "New Transformer"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = create_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="New Transformer",
+ script="def transform(data): return data",
+ script_timeout="60s",
+ enabled=True,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once()
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["method"] == "POST"
+ assert (
+ call_kwargs["endpoint_path"]
+ == "integrations/test-integration/transformers"
+ )
+ assert call_kwargs["api_version"] == APIVersion.V1ALPHA
+ assert call_kwargs["json"]["displayName"] == "New Transformer"
+ assert call_kwargs["json"]["script"] == "def transform(data): return data"
+ assert call_kwargs["json"]["scriptTimeout"] == "60s"
+ assert call_kwargs["json"]["enabled"] is True
+
+
+def test_create_integration_transformer_with_all_fields(chronicle_client):
+ """Test create_integration_transformer with all optional fields."""
+ expected = {"name": "transformer1"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request:
+ result = create_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="Full Transformer",
+ script="def transform(data): return data",
+ script_timeout="120s",
+ enabled=False,
+ description="Test transformer description",
+ parameters=[{"name": "param1", "type": "STRING"}],
+ usage_example="Example usage",
+ expected_output="Output format",
+ expected_input="Input format",
+ )
+
+ assert result == expected
+
+ call_kwargs = mock_request.call_args[1]
+ body = call_kwargs["json"]
+ assert body["displayName"] == "Full Transformer"
+ assert body["description"] == "Test transformer description"
+ assert body["parameters"] == [{"name": "param1", "type": "STRING"}]
+ assert body["usageExample"] == "Example usage"
+ assert body["expectedOutput"] == "Output format"
+ assert body["expectedInput"] == "Input format"
+
+
+# -- update_integration_transformer tests --
+
+
+def test_update_integration_transformer_display_name(chronicle_client):
+ """Test update_integration_transformer updates display name."""
+ expected = {"name": "transformer1", "displayName": "Updated Name"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.build_patch_body",
+ return_value=({"displayName": "Updated Name"}, {"updateMask": "displayName"}),
+ ) as mock_build:
+ result = update_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ display_name="Updated Name",
+ )
+
+ assert result == expected
+
+ mock_build.assert_called_once()
+ mock_request.assert_called_once()
+ call_kwargs = mock_request.call_args[1]
+ assert call_kwargs["method"] == "PATCH"
+ assert (
+ call_kwargs["endpoint_path"]
+ == "integrations/test-integration/transformers/transformer1"
+ )
+
+
+def test_update_integration_transformer_with_update_mask(chronicle_client):
+ """Test update_integration_transformer with explicit update mask."""
+ expected = {"name": "transformer1"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.build_patch_body",
+ return_value=(
+ {"displayName": "New Name", "enabled": True},
+ {"updateMask": "displayName,enabled"},
+ ),
+ ):
+ result = update_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ display_name="New Name",
+ enabled=True,
+ update_mask="displayName,enabled",
+ )
+
+ assert result == expected
+
+
+def test_update_integration_transformer_all_fields(chronicle_client):
+ """Test update_integration_transformer with all fields."""
+ expected = {"name": "transformer1"}
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.build_patch_body",
+ return_value=(
+ {
+ "displayName": "Updated",
+ "script": "new script",
+ "scriptTimeout": "90s",
+ "enabled": False,
+ "description": "Updated description",
+ "parameters": [{"name": "p1"}],
+ "usageExample": "New example",
+ "expectedOutput": "New output",
+ "expectedInput": "New input",
+ },
+ {"updateMask": "displayName,script,scriptTimeout,enabled,description"},
+ ),
+ ):
+ result = update_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ display_name="Updated",
+ script="new script",
+ script_timeout="90s",
+ enabled=False,
+ description="Updated description",
+ parameters=[{"name": "p1"}],
+ usage_example="New example",
+ expected_output="New output",
+ expected_input="New input",
+ )
+
+ assert result == expected
+
+
+# -- execute_integration_transformer_test tests --
+
+
+def test_execute_integration_transformer_test_success(chronicle_client):
+ """Test execute_integration_transformer_test delegates to chronicle_request."""
+ transformer = {
+ "displayName": "Test Transformer",
+ "script": "def transform(data): return data",
+ }
+ expected = {
+ "outputMessage": "Success",
+ "debugOutputMessage": "Debug info",
+ "resultValue": {"status": "ok"},
+ }
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = execute_integration_transformer_test(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer=transformer,
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="POST",
+ endpoint_path="integrations/test-integration/transformers:executeTest",
+ api_version=APIVersion.V1ALPHA,
+ json={"transformer": transformer},
+ )
+
+
+# -- get_integration_transformer_template tests --
+
+
+def test_get_integration_transformer_template_success(chronicle_client):
+ """Test get_integration_transformer_template delegates to chronicle_request."""
+ expected = {
+ "script": "def transform(data):\n # Template code\n return data",
+ "displayName": "Template Transformer",
+ }
+
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ return_value=expected,
+ ) as mock_request, patch(
+ "secops.chronicle.integration.transformers.format_resource_id",
+ return_value="test-integration",
+ ):
+ result = get_integration_transformer_template(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+ assert result == expected
+
+ mock_request.assert_called_once_with(
+ chronicle_client,
+ method="GET",
+ endpoint_path="integrations/test-integration/transformers:fetchTemplate",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+# -- Error handling tests --
+
+
+def test_list_integration_transformers_api_error(chronicle_client):
+ """Test list_integration_transformers handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_paginated_request",
+ side_effect=APIError("API Error"),
+ ):
+ with pytest.raises(APIError, match="API Error"):
+ list_integration_transformers(
+ chronicle_client,
+ integration_name="test-integration",
+ )
+
+
+def test_get_integration_transformer_api_error(chronicle_client):
+ """Test get_integration_transformer handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ side_effect=APIError("Not found"),
+ ):
+ with pytest.raises(APIError, match="Not found"):
+ get_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="nonexistent",
+ )
+
+
+def test_create_integration_transformer_api_error(chronicle_client):
+ """Test create_integration_transformer handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ side_effect=APIError("Creation failed"),
+ ):
+ with pytest.raises(APIError, match="Creation failed"):
+ create_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ display_name="New Transformer",
+ script="def transform(data): return data",
+ script_timeout="60s",
+ enabled=True,
+ )
+
+
+def test_update_integration_transformer_api_error(chronicle_client):
+ """Test update_integration_transformer handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ side_effect=APIError("Update failed"),
+ ), patch(
+ "secops.chronicle.integration.transformers.build_patch_body",
+ return_value=({"displayName": "Updated"}, {"updateMask": "displayName"}),
+ ):
+ with pytest.raises(APIError, match="Update failed"):
+ update_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ display_name="Updated",
+ )
+
+
+def test_delete_integration_transformer_api_error(chronicle_client):
+ """Test delete_integration_transformer handles API errors."""
+ with patch(
+ "secops.chronicle.integration.transformers.chronicle_request",
+ side_effect=APIError("Delete failed"),
+ ):
+ with pytest.raises(APIError, match="Delete failed"):
+ delete_integration_transformer(
+ chronicle_client,
+ integration_name="test-integration",
+ transformer_id="transformer1",
+ )
+
diff --git a/tests/chronicle/utils/test_format_utils.py b/tests/chronicle/utils/test_format_utils.py
index c71bda40..5610c2da 100644
--- a/tests/chronicle/utils/test_format_utils.py
+++ b/tests/chronicle/utils/test_format_utils.py
@@ -18,6 +18,7 @@
import pytest
from secops.chronicle.utils.format_utils import (
+ build_patch_body,
format_resource_id,
parse_json_list,
)
@@ -98,3 +99,107 @@ def test_parse_json_list_handles_empty_json_array() -> None:
def test_parse_json_list_handles_empty_list_input() -> None:
result = parse_json_list([], "filters")
assert result == []
+
+
+def test_build_patch_body_all_fields_set_builds_body_and_mask() -> None:
+ # All three fields provided — body and mask should include all of them
+ body, params = build_patch_body([
+ ("displayName", "display_name", "My Rule"),
+ ("enabled", "enabled", True),
+ ("severity", "severity", "HIGH"),
+ ])
+
+ assert body == {"displayName": "My Rule", "enabled": True, "severity": "HIGH"}
+ assert params == {"updateMask": "display_name,enabled,severity"}
+
+
+def test_build_patch_body_partial_fields_omits_none_values() -> None:
+ # Only non-None values should appear in body and mask
+ body, params = build_patch_body([
+ ("displayName", "display_name", "New Name"),
+ ("enabled", "enabled", None),
+ ("severity", "severity", None),
+ ])
+
+ assert body == {"displayName": "New Name"}
+ assert params == {"updateMask": "display_name"}
+
+
+def test_build_patch_body_no_fields_set_returns_empty_body_and_none_params() -> None:
+ # All values are None — body should be empty and params should be None
+ body, params = build_patch_body([
+ ("displayName", "display_name", None),
+ ("enabled", "enabled", None),
+ ])
+
+ assert body == {}
+ assert params is None
+
+
+def test_build_patch_body_empty_field_map_returns_empty_body_and_none_params() -> None:
+ # Empty field_map — nothing to build
+ body, params = build_patch_body([])
+
+ assert body == {}
+ assert params is None
+
+
+def test_build_patch_body_explicit_update_mask_overrides_auto_generated() -> None:
+ # An explicit update_mask should always win, even when fields are set
+ body, params = build_patch_body(
+ [
+ ("displayName", "display_name", "Name"),
+ ("enabled", "enabled", True),
+ ],
+ update_mask="display_name",
+ )
+
+ assert body == {"displayName": "Name", "enabled": True}
+ assert params == {"updateMask": "display_name"}
+
+
+def test_build_patch_body_explicit_update_mask_with_no_fields_set_still_applies() -> None:
+ # Explicit mask should appear even when all values are None (caller's intent)
+ body, params = build_patch_body(
+ [
+ ("displayName", "display_name", None),
+ ],
+ update_mask="display_name",
+ )
+
+ assert body == {}
+ assert params == {"updateMask": "display_name"}
+
+
+def test_build_patch_body_false_and_zero_are_not_treated_as_none() -> None:
+ # False-like but non-None values (False, 0, "") should be included in the body
+ body, params = build_patch_body([
+ ("enabled", "enabled", False),
+ ("count", "count", 0),
+ ("label", "label", ""),
+ ])
+
+ assert body == {"enabled": False, "count": 0, "label": ""}
+ assert params == {"updateMask": "enabled,count,label"}
+
+
+def test_build_patch_body_single_field_produces_single_entry_mask() -> None:
+ body, params = build_patch_body([
+ ("severity", "severity", "LOW"),
+ ])
+
+ assert body == {"severity": "LOW"}
+ assert params == {"updateMask": "severity"}
+
+
+def test_build_patch_body_mask_order_matches_field_map_order() -> None:
+ # The mask field order should mirror the order of field_map entries
+ body, params = build_patch_body([
+ ("z", "z_key", "z_val"),
+ ("a", "a_key", "a_val"),
+ ("m", "m_key", "m_val"),
+ ])
+
+ assert params == {"updateMask": "z_key,a_key,m_key"}
+ assert list(body.keys()) == ["z", "a", "m"]
+
diff --git a/tests/chronicle/utils/test_request_utils.py b/tests/chronicle/utils/test_request_utils.py
index 6f8687a2..c4e8b5b9 100644
--- a/tests/chronicle/utils/test_request_utils.py
+++ b/tests/chronicle/utils/test_request_utils.py
@@ -26,6 +26,7 @@
from secops.chronicle.utils.request_utils import (
DEFAULT_PAGE_SIZE,
chronicle_request,
+ chronicle_request_bytes,
chronicle_paginated_request,
)
from secops.exceptions import APIError
@@ -655,3 +656,181 @@ def test_chronicle_request_non_json_error_body_is_truncated(client: Mock) -> Non
assert "status=500" in msg
# Should not include the full 5000 chars, should include truncation marker
assert "truncated" in msg
+
+
+# ---------------------------------------------------------------------------
+# chronicle_request_bytes() tests
+# ---------------------------------------------------------------------------
+
+def test_chronicle_request_bytes_success_returns_content_and_stream_true(client: Mock) -> None:
+ resp = _mock_response(status_code=200, json_value={"ignored": True})
+ resp.content = b"PK\x03\x04...zip-bytes..." # ZIP magic prefix in real life
+ client.session.request.return_value = resp
+
+ out = chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="integrations/foo:export",
+ api_version=APIVersion.V1BETA,
+ params={"alt": "media"},
+ headers={"Accept": "application/zip"},
+ )
+
+ assert out == b"PK\x03\x04...zip-bytes..."
+
+ client.base_url.assert_called_once_with(APIVersion.V1BETA)
+ client.session.request.assert_called_once_with(
+ method="GET",
+ url="https://example.test/chronicle/instances/instance-1/integrations/foo:export",
+ params={"alt": "media"},
+ headers={"Accept": "application/zip"},
+ timeout=None,
+ stream=True,
+ )
+
+
+def test_chronicle_request_bytes_builds_url_for_rpc_colon_prefix(client: Mock) -> None:
+ resp = _mock_response(status_code=200, json_value={"ok": True})
+ resp.content = b"binary"
+ client.session.request.return_value = resp
+
+ out = chronicle_request_bytes(
+ client=client,
+ method="POST",
+ endpoint_path=":exportSomething",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+ assert out == b"binary"
+
+ _, kwargs = client.session.request.call_args
+ assert kwargs["url"] == "https://example.test/chronicle/instances/instance-1:exportSomething"
+ assert kwargs["stream"] is True
+
+
+def test_chronicle_request_bytes_accepts_multiple_expected_statuses_set(client: Mock) -> None:
+ resp = _mock_response(status_code=204, json_value=None)
+ resp.content = b""
+ client.session.request.return_value = resp
+
+ out = chronicle_request_bytes(
+ client=client,
+ method="DELETE",
+ endpoint_path="something",
+ api_version=APIVersion.V1ALPHA,
+ expected_status={200, 204},
+ )
+
+ assert out == b""
+
+
+def test_chronicle_request_bytes_status_mismatch_with_json_includes_json(client: Mock) -> None:
+ resp = _mock_response(status_code=400, json_value={"error": "bad"})
+ resp.content = b""
+ client.session.request.return_value = resp
+
+ with pytest.raises(
+ APIError,
+ match=r"API request failed: method=GET, "
+ r"url=https://example\.test/chronicle/instances/instance-1/curatedRules"
+ r", status=400, response={'error': 'bad'}",
+ ):
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="curatedRules",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+def test_chronicle_request_bytes_status_mismatch_non_json_includes_text(client: Mock) -> None:
+ resp = _mock_response(status_code=500, json_raises=True, text="boom")
+ resp.content = b""
+ client.session.request.return_value = resp
+
+ with pytest.raises(
+ APIError,
+ match=r"API request failed: method=GET, "
+ r"url=https://example\.test/chronicle/instances/instance-1/curatedRules, "
+ r"status=500, response_text=boom",
+ ):
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="curatedRules",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+
+def test_chronicle_request_bytes_custom_error_message_used(client: Mock) -> None:
+ resp = _mock_response(status_code=404, json_value={"message": "not found"})
+ resp.content = b""
+ client.session.request.return_value = resp
+
+ with pytest.raises(
+ APIError,
+ match=r"Failed to download export: method=GET, "
+ r"url=https://example\.test/chronicle/instances/instance-1/integrations/foo:export, "
+ r"status=404, response={'message': 'not found'}",
+ ):
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="integrations/foo:export",
+ api_version=APIVersion.V1BETA,
+ error_message="Failed to download export",
+ )
+
+
+def test_chronicle_request_bytes_wraps_requests_exception(client: Mock) -> None:
+ client.session.request.side_effect = requests.RequestException("no route to host")
+
+ with pytest.raises(APIError) as exc_info:
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="curatedRules",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+ msg = str(exc_info.value)
+ assert "API request failed" in msg
+ assert "method=GET" in msg
+ assert "url=https://example.test/chronicle/instances/instance-1/curatedRules" in msg
+ assert "request_error=RequestException" in msg
+
+
+def test_chronicle_request_bytes_wraps_google_auth_error(client: Mock) -> None:
+ client.session.request.side_effect = GoogleAuthError("invalid_grant")
+
+ with pytest.raises(APIError) as exc_info:
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="curatedRules",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+ msg = str(exc_info.value)
+ assert "Google authentication failed" in msg
+ assert "authentication_error=" in msg
+
+
+def test_chronicle_request_bytes_non_json_error_body_is_truncated(client: Mock) -> None:
+ long_text = "x" * 5000
+ resp = _mock_response(status_code=500, json_raises=True, text=long_text)
+ resp.content = b""
+ resp.headers = {"Content-Type": "text/plain"}
+ client.session.request.return_value = resp
+
+ with pytest.raises(APIError) as exc_info:
+ chronicle_request_bytes(
+ client=client,
+ method="GET",
+ endpoint_path="curatedRules",
+ api_version=APIVersion.V1ALPHA,
+ )
+
+ msg = str(exc_info.value)
+ assert "status=500" in msg
+ assert "truncated" in msg
\ No newline at end of file