fn icon indicating copy to clipboard operation
fn copied to clipboard

[0.2] enabled/disabled status for functions/triggers

Open rdallman opened this issue 6 years ago • 1 comments

it would be great if functions and triggers had a field such as:

status: disabled

which would allow a user to turn a function or trigger off. say, you write a function that calls [a trigger of] itself, or your database goes down and sending it more requests isn't helping to get it back online, or in the functions case say the registry holding that function image is unavailable. this allows a user to leave their functions/triggers in place without having to delete them to get this behavior, as it can be hard to rebuild this state if a user is not fully prepared (everything becomes a legacy app eventually).

proposed enum values to start: { "enabled", "disabled" }, where this field is a string and we could possibly add more values at a later date. the default value is "enabled" and functions & triggers would behave the same as before if a status is not provided by the user.

scope of work is adding the API / datastore plumbing, and in addition to that we will need to stop short in the invocation path with a user friendly error along the lines of HTTP 403 (?) + {"message":"trigger is disabled"} when a trigger (or function) is disabled.

this is an additive and not a breaking change, so we can slot this in later in the 0.2 scope (or after it).

rdallman avatar Jun 25 '18 18:06 rdallman

This would probably make a good first (or second) project.

I had a quick look at writing a proof of concept so I could learn more about how the internals worked. If it helps, you can find what I done for this here: https://github.com/vzDevelopment/fn/commit/33329c1cdd3c1113ec396236fa29aef51e209afa.

vzDevelopment avatar Apr 10 '19 13:04 vzDevelopment