RateLimit() and LabelConfig().
Configuration methods
TheResourcePlugin interface requires three configuration methods:
We’ll implement the first two now.
DiscoveryFilters() is covered in Discovery filters.
RateLimit
SFTP servers typically limit concurrent connections. TheRateLimit() method tells formae how fast it can send requests to your plugin.
Configuration fields
Choosing a rate limit
Consider your target system’s limits:- SFTP servers: Often allow 5-10 concurrent connections
- Cloud APIs: Check the provider’s documentation (AWS: varies by service, typically 10-100 RPS)
- SaaS APIs: Usually documented in API docs (e.g., “100 requests per minute”)
Why rate limiting matters
formae runs multiple operations concurrently:- User-triggered applies and destroys
- Background synchronization (periodic reads)
- Discovery scans
LabelConfig
When formae discovers resources, it needs a human-readable label to display. TheLabelConfig() method tells formae how to extract labels from your resources.
Configuration fields
JSONPath for labels
TheDefaultQuery is a JSONPath expression that extracts a label from the resource’s JSON representation. For our File resource:
$.path extracts /data/config.txt as the label.
Resource overrides
If your plugin has multiple resource types with different naming conventions, useResourceOverrides:
DiscoveryFilters (optional)
TheDiscoveryFilters() method excludes certain resources from discovery. For now, we return nil to discover all files:
Update sftp.go
The template already has these methods. UpdateRateLimit() and LabelConfig() with our values:
Verify
To verify that the configuration methods compile correctly:Summary
With configuration methods complete, your plugin now tells formae:- Rate limit: 5 requests per second to protect the SFTP server
- Labels: Use the file path as the display name for discovered files
- Discovery filters: Discover all files (no exclusions)
Next: 05 - Create

