Skip to content

Migrate collection operations from APIHarnessV2 to CustomStorage#118

Merged
mraible merged 7 commits intomainfrom
chore/use-custom-storage-service-class
Apr 16, 2026
Merged

Migrate collection operations from APIHarnessV2 to CustomStorage#118
mraible merged 7 commits intomainfrom
chore/use-custom-storage-service-class

Conversation

@mraible
Copy link
Copy Markdown
Contributor

@mraible mraible commented Mar 31, 2026

Replaces APIHarnessV2 (Uber class) with CustomStorage (service class) for collection CRUD operations in the log-event function handler.

The Falcon Foundry Functions Editor parses from falconpy import CustomStorage to auto-detect required OAuth scopes (custom-storage:read, custom-storage:write). It cannot parse the Uber class .command() pattern, which means apps using APIHarnessV2 require manual scope configuration.

Changes in log-event/main.py:

  • APIHarnessV2().command("PutObject", ...)CustomStorage(ext_headers=...).PutObject(...)
  • APIHarnessV2().command("SearchObjects", ...)client.SearchObjects(...)
  • Added defensive .get("body", {}) for SearchObjects response handling

The ext_headers constructor parameter replaces per-request headers kwargs, applying the X-CS-APP-ID header to all requests from the client instance. Response shapes and behavior are unchanged.

Draft because the associated blog post needs updating to match the new patterns.

mraible added 2 commits March 23, 2026 11:29
Use CustomStorage service class instead of APIHarnessV2 (Uber class) for
collection CRUD operations. Service class imports enable the Foundry Functions
Editor to auto-detect required OAuth scopes, which is not possible with
Uber class .command() calls.

Changes:
- Replace APIHarnessV2 with CustomStorage(ext_headers=_app_headers())
- Replace .command("PutObject"/"SearchObjects") with .PutObject()/.SearchObjects()
- Add defensive .get() for SearchObjects response body
- Move header construction to _app_headers() helper
@mraible mraible requested a review from a team March 31, 2026 20:27
mraible added 2 commits March 31, 2026 14:49
Align test mocks with the APIHarnessV2-to-CustomStorage migration in
main.py: patch CustomStorage instead of APIHarnessV2, mock individual
PutObject/SearchObjects methods instead of .command() side_effect, and
verify ext_headers construction instead of per-request headers kwargs.
Comment thread functions/log-event/main.py
Add verifyWorkflowExecutionCompleted() that polls the execution status
page until terminal state, catching function failures that were
previously invisible.
@mraible mraible marked this pull request as ready for review April 16, 2026 01:11
@mraible mraible requested a review from prvn April 16, 2026 01:16
@mraible mraible merged commit 733d209 into main Apr 16, 2026
19 checks passed
@mraible mraible deleted the chore/use-custom-storage-service-class branch April 16, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants