Overview
Add support for Fastly's Access Control Lists (ACLs), providing IP-based blocklists and access control.
WIT Interface
interface acl {
use types.{error, open-error, ip-address};
resource acl {
open: static func(name: string) -> result<acl, open-error>;
lookup: func(ip-addr: ip-address) -> result<option<body>, acl-error>;
}
enum acl-error {
too-many-requests,
generic-error
}
}
WIT bindings: stubs/wit_world/imports/acl.py
API Design
- Implement
ACL resource wrapper
lookup(ip) accepts str, IPv4Address, or IPv6Address and returns Optional[dict]
- Parse JSON body response from WIT layer when IP matches ACL entry
- Return
None when IP not found in ACL (no match)
Cross-SDK Comparison: All SDKs expose open(name) and lookup(ip) returning entry with prefix, action, id fields. Simple consistent API across languages.
Viceroy Testing
Viceroy supports ACL with JSON file-based test data via test.toml:
[local_server]
# Path to JSON file with ACL entries
acls.my_blocklist = "../data/acl.json"
# Or using object syntax
acls.my_allowlist = { file = "../data/allowlist.json" }
ACL JSON file format maps IP addresses to metadata objects. Lookup operations work with test data. Tests can use @on_viceroy with file references in TOML configuration.
Reference
Overview
Add support for Fastly's Access Control Lists (ACLs), providing IP-based blocklists and access control.
WIT Interface
WIT bindings:
stubs/wit_world/imports/acl.pyAPI Design
ACLresource wrapperlookup(ip)acceptsstr,IPv4Address, orIPv6Addressand returnsOptional[dict]Nonewhen IP not found in ACL (no match)Cross-SDK Comparison: All SDKs expose
open(name)andlookup(ip)returning entry withprefix,action,idfields. Simple consistent API across languages.Viceroy Testing
Viceroy supports ACL with JSON file-based test data via
test.toml:ACL JSON file format maps IP addresses to metadata objects. Lookup operations work with test data. Tests can use
@on_viceroywith file references in TOML configuration.Reference