diff --git a/polyapi/cli.py b/polyapi/cli.py index 4027463..66dd234 100644 --- a/polyapi/cli.py +++ b/polyapi/cli.py @@ -28,6 +28,7 @@ def execute_from_cli() -> None: parser.add_argument("--server", action="store_true", help="Pass --server when adding function to add a server function.") parser.add_argument("--logs", action="store_true", help="Pass --logs when adding function if you want to store and see the function logs.") parser.add_argument("--skip-generate", action="store_true", help="Pass --skip-generate to skip generating the library after adding a function.") + parser.add_argument("--execution-api-key", required=False, default="", help="API key for execution (for server functions only).") parser.add_argument("command", choices=CLI_COMMANDS) parser.add_argument("subcommands", nargs="*") args = parser.parse_args() @@ -59,4 +60,13 @@ def execute_from_cli() -> None: if args.subcommands[0] == "execute": print(function_execute(args.context, args.subcommands)) else: - function_add_or_update(args.context, args.description, args.client, args.server, args.logs, args.subcommands, not args.skip_generate) + function_add_or_update( + context=args.context, + description=args.description, + client=args.client, + server=args.server, + logs_enabled=args.logs, + subcommands=args.subcommands, + generate=not args.skip_generate, + execution_api_key=args.execution_api_key + ) diff --git a/polyapi/function_cli.py b/polyapi/function_cli.py index c6ec54d..15e5f7b 100644 --- a/polyapi/function_cli.py +++ b/polyapi/function_cli.py @@ -208,6 +208,7 @@ def function_add_or_update( logs_enabled: bool, subcommands: List, generate: bool = True, + execution_api_key: str = "" ): parser = argparse.ArgumentParser() parser.add_argument("subcommand", choices=["add"]) @@ -256,6 +257,10 @@ def function_add_or_update( assert api_key if server: url = f"{api_url}/functions/server" + + if execution_api_key: + data["executionApiKey"] = execution_api_key + elif client: url = f"{api_url}/functions/client" else: diff --git a/pyproject.toml b/pyproject.toml index 33a89f6..3969c19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.2.9" +version = "0.3.0" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [