It should be possible to set the Expiry (and similar metadata) of a Document from within the Function.
MB-29200 Support Other Bucket Ops from Eventing Functions
MB-40360 [BP MB-29200] - Support Other Bucket Ops from Eventing Functions