Skip to content

Commit b143702

Browse files
committed
Updates after testing
1 parent 227a3e7 commit b143702

File tree

8 files changed

+12
-130
lines changed

8 files changed

+12
-130
lines changed

functions/hosts-query/main.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

functions/hosts-query/request_schema.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

functions/hosts-query/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

functions/hosts-query/response_schema.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

functions/log-event/main.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ def on_post(request: FoundryRequest) -> FoundryResponse:
3232
object_key="event_id"
3333
)
3434

35-
if response.status_code != 201:
35+
if response["status_code"] != 201:
36+
error_message = response.get('error', {}).get('message', 'Unknown error')
3637
return FoundryResponse(
37-
code=response.status_code,
38+
code=response["status_code"],
3839
errors=[FoundryAPIError(
39-
code=response.status_code,
40-
message=f"Failed to store event: {response.text}"
40+
code=response["status_code"],
41+
message=f"Failed to store event: {error_message}"
4142
)]
4243
)
4344

@@ -51,15 +52,15 @@ def on_post(request: FoundryRequest) -> FoundryResponse:
5152
return FoundryResponse(
5253
body={
5354
"stored": True,
54-
"record_id": response.json().get("id"),
55-
"recent_events": query_response.json().get("resources", [])
55+
"record_id": response["id"],
56+
"recent_events": query_response.get("resources", [])
5657
},
5758
code=200
5859
)
5960
except Exception as e:
6061
return FoundryResponse(
6162
code=500,
62-
errors=[FoundryAPIError(code=500, message=f"Error with collection: {str(e)}")]
63+
errors=[FoundryAPIError(code=500, message=f"Error saving collection: {str(e)}")]
6364
)
6465

6566

functions/servicenow/main.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,8 @@ def on_post(request: FoundryRequest, config: Dict[str, object] | None, logger: L
5353

5454
logger.info(f"Creating ServiceNow incident with payload: {payload}")
5555

56-
# Call ServiceNow Table API to create incident
5756
try:
58-
body = {
59-
"resources": [{
60-
"definition_id": "ServiceNow",
61-
"operation_id": "POST__api_now_table_tablename",
62-
"params": {
63-
"path": {
64-
"tableName": "incident",
65-
}
66-
},
67-
"request": {
68-
"json": payload
69-
}
70-
}]
71-
}
72-
73-
# Use the APIIntegrations client to call ServiceNow
57+
# Use the APIIntegrations client to call ServiceNow Table API to create incident
7458
api = APIIntegrations()
7559
response = api.execute_command_proxy(
7660
definition_id="ServiceNow",
@@ -93,9 +77,9 @@ def on_post(request: FoundryRequest, config: Dict[str, object] | None, logger: L
9377
if response["status_code"] >= 400:
9478
error_message = response.get('error', {}).get('message', 'Unknown error')
9579
return FoundryResponse(
96-
code=response.status_code,
80+
code=response["status_code"],
9781
errors=[FoundryAPIError(
98-
code=response.status_code,
82+
code=response["status_code"],
9983
message=f"ServiceNow integration error: {error_message}"
10084
)]
10185
)

images/logo.png

21.4 KB
Loading

manifest.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
app_id: 6ddb0b6688a345bdafaae5d5678477f3
22
name: functions-python
33
description: Foundry sample that shows how to use Python functions
4-
logo: ""
4+
logo: "images/logo.png"
55
vendor: ""
66
vendor_products: []
77
use_case: Cloud security
@@ -157,31 +157,6 @@ functions:
157157
- FalconPy
158158
permissions: []
159159
language: python
160-
- id: 54320438ff5642bfb54d12edb18fceff
161-
name: hosts-query
162-
config: null
163-
description: Query a Host with Good Logging
164-
path: functions/hosts-query
165-
environment_variables: {}
166-
handlers:
167-
- name: hosts-query
168-
description: Query a Host with Good Logging
169-
method: POST
170-
api_path: /hosts-query
171-
payload_type: ""
172-
request_schema: request_schema.json
173-
response_schema: response_schema.json
174-
workflow_integration:
175-
id: f1f261a5815549d48489d4af0d9a52a7
176-
disruptive: false
177-
system_action: true
178-
tags:
179-
- 6ddb0b6688a345bdafaae5d5678477f3
180-
- Functions
181-
- Logging
182-
- FalconPy
183-
permissions: []
184-
language: python
185160
- id: 86c21f8136204c30bcddccfab707d939
186161
name: host-info
187162
config: null

0 commit comments

Comments
 (0)