Skip to content

Instantly share code, notes, and snippets.

@hammertoe
Created May 28, 2020 18:53
Show Gist options
  • Save hammertoe/4f3409dad274162c0b0180d140387d11 to your computer and use it in GitHub Desktop.
Save hammertoe/4f3409dad274162c0b0180d140387d11 to your computer and use it in GitHub Desktop.
Example of some IBM Cloud Function commands
# A simple hello world function
% cat hello.py
def main(args):
name = args.get("name", "unknown")
return {"message": f"Hello {name}!"}
# create an action
% ic fn action create hello hello.py
ok: created action hello
# list actions
% ic fn action list
actions
/[email protected]_dev/hello private python:3.7
# invoke a function
% ic fn action invoke hello -r
{
"message": "Hello unknown!"
}
# Update a function
% ic fn action update hello hello.py
ok: updated action hello
# Delete a function
% ic fn action delete hello
ok: deleted action hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment