diff --git a/notes-python/code/notes-list/notes_list.py b/notes-python/code/notes-list/notes_list.py index af04860..4e63bf2 100644 --- a/notes-python/code/notes-list/notes_list.py +++ b/notes-python/code/notes-list/notes_list.py @@ -15,7 +15,7 @@ import psycopg2 import psycopg2.extras -def handle(event): +def list_notes(event): dsn = os.environ['PG_DSN'] conn = psycopg2.connect(dsn) try: diff --git a/notes-python/code/notes/notes_crud.py b/notes-python/code/notes/notes_crud.py index 23e307a..07b2592 100644 --- a/notes-python/code/notes/notes_crud.py +++ b/notes-python/code/notes/notes_crud.py @@ -17,7 +17,7 @@ import psycopg2 import psycopg2.extras -def handle(event): +def crud(event): dsn = os.environ['PG_DSN'] # sub-path без ведущего слэша: "add", "update", "delete" action = event.get('_path', '/').strip('/') diff --git a/notes-python/code/sql-runner/sql_runner.py b/notes-python/code/sql-runner/sql_runner.py index d71828e..fae7675 100644 --- a/notes-python/code/sql-runner/sql_runner.py +++ b/notes-python/code/sql-runner/sql_runner.py @@ -19,7 +19,7 @@ import os import psycopg2 -def handle(event): +def run_sql(event): dsn = os.environ['PG_DSN'] statements = event.get('statements', []) if not statements: diff --git a/notes-python/dist/notes-list.zip b/notes-python/dist/notes-list.zip index ee6206f..bcf1f18 100644 Binary files a/notes-python/dist/notes-list.zip and b/notes-python/dist/notes-list.zip differ diff --git a/notes-python/dist/notes.zip b/notes-python/dist/notes.zip index a282a90..628ff16 100644 Binary files a/notes-python/dist/notes.zip and b/notes-python/dist/notes.zip differ diff --git a/notes-python/dist/sql-runner.zip b/notes-python/dist/sql-runner.zip index d2083fe..6ae5e84 100644 Binary files a/notes-python/dist/sql-runner.zip and b/notes-python/dist/sql-runner.zip differ diff --git a/notes-python/notes-list.tf b/notes-python/notes-list.tf index 3e5e2f7..5ed81f5 100644 --- a/notes-python/notes-list.tf +++ b/notes-python/notes-list.tf @@ -16,12 +16,12 @@ data "archive_file" "notes_list_zip" { } # Read-only функция в кластере. -# entrypoint = "notes_list.handle" → файл notes_list.py, функция handle(). +# entrypoint = "notes_list.list_notes" → файл notes_list.py, функция list_notes(). resource "sless_function" "notes_list" { namespace = "default" name = "notes-list" runtime = "python3.11" - entrypoint = "notes_list.handle" + entrypoint = "notes_list.list_notes" memory_mb = 128 timeout_sec = 30 diff --git a/notes-python/notes.tf b/notes-python/notes.tf index 64e989f..8e2a17c 100644 --- a/notes-python/notes.tf +++ b/notes-python/notes.tf @@ -18,12 +18,12 @@ data "archive_file" "notes_crud_zip" { } # CRUD функция в кластере. -# entrypoint = "notes_crud.handle" → файл notes_crud.py, функция handle(). +# entrypoint = "notes_crud.crud" → файл notes_crud.py, функция crud(). resource "sless_function" "notes_crud" { namespace = "default" name = "notes" runtime = "python3.11" - entrypoint = "notes_crud.handle" + entrypoint = "notes_crud.crud" memory_mb = 128 timeout_sec = 30 diff --git a/notes-python/sql-runner.tf b/notes-python/sql-runner.tf index 86bcabc..9800b6d 100644 --- a/notes-python/sql-runner.tf +++ b/notes-python/sql-runner.tf @@ -14,13 +14,13 @@ data "archive_file" "sql_runner_zip" { } # Сама функция в кластере. -# entrypoint = "sql_runner.handle" → файл sql_runner.py, функция handle(). +# entrypoint = "sql_runner.run_sql" → файл sql_runner.py, функция run_sql(). # memory_mb=128 достаточно — DDL запросы не требуют памяти на вычисления. resource "sless_function" "sql_runner" { namespace = "default" name = "sql-runner" runtime = "python3.11" - entrypoint = "sql_runner.handle" + entrypoint = "sql_runner.run_sql" memory_mb = 128 timeout_sec = 30