List method. List enables resource discovery: finding resources that exist in the infrastructure but aren’t yet managed by formae.
What is discovery?
Discovery allows formae to find “unmanaged” resources: resources that exist in your infrastructure but weren’t created through formae. This is useful for:- Importing existing infrastructure: bring pre-existing resources under formae management
- Detecting out-of-band resources: find resources created outside of formae
- Inventory auditing: get a complete view of what exists
List vs Read
- List returns resource identifiers (native IDs)
- Read is then called for each ID to get full properties
ListRequest
The agent sends aListRequest during discovery:
ListResult containing the native IDs found:
NextPageToken. The agent will call List again with this token until it’s nil.
Test
Add a test for List tosftp_test.go:
Test pattern
Run the test to verify it fails
not implemented.
Implementation
Key points
- Return native IDs: just the file paths, not full properties
- Handle empty gracefully: return empty list, not an error
- Pagination support: use
NextPageTokenfor large result sets (not needed here) - AdditionalProperties: can be used for discovery configuration (e.g., which directory to scan)
Verify
Run the test to confirm List discovers files correctly:Discovery flow
Here’s how discovery works end-to-end:- Agent calls List and the plugin returns all native IDs
- Agent compares to inventory and identifies unmanaged resources
- Agent calls Read for each unmanaged resource to get full properties
- Agent presents to user who can import into formae management
Non-discoverable resources
Some resource types cannot be listed. For example, the infrastructure API might not provide a list endpoint. In these cases, mark the resource as non-discoverable in its schema:Summary
List enables resource discovery:
With List implemented, your plugin supports the complete discovery workflow.
Next: 10 - Error Handling - Deep dive into OperationErrorCode patterns

