function_accepts_context: Determine if a function accepts a 'context' argument

View source: R/lambda-config.R

function_accepts_contextR Documentation

Determine if a function accepts a context argument

Description

The context of a Lambda is the metadata associated with each request, such as the ARN. In other languages, a function used in a Lambda must accept the context as an argument. We allow here for functions that disregard it, since it's not necessary.

The purpose of functions_accepts_context then is to determine if the arguments of the function defined by the handler includes context, in which case we pass the context as an argument whenever the Lambda is invoked. The context argument must be named (... won't be recognised). Primitive functions will always return FALSE.

Usage

function_accepts_context(func)

Arguments

func

Function that may or may not accept a context argument

Value

logical


lambdr documentation built on Nov. 25, 2023, 5:08 p.m.