# Finalize job

Marks a completed transfer job as `COMPLETED` via `ows-project-manager`. This is the terminal success step in the product transfer Step Function.

## Event payload

### Input

| Field | Type | Description |
|-------|------|-------------|
| `job_id` | `int` | ID of the transfer job to finalize. |

### Output

```json
{"statusCode": 200}
```

## Setup

This Lambda uses M2M token authentication, which requires AWS access to retrieve credentials at runtime. See [AWS Access](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f) for setup instructions.

Run locally — exposes the Lambda invocation endpoint on port 9000:
```sh
docker compose up dev
```

Invoke the function in a second terminal:
```sh
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"job_id": 123}'
```

## Development

Run linting and tests:
```sh
docker compose run --rm --build unit-lint
```

Format code:
```sh
docker compose run --rm --build format
```

Update the lock file (required after changing `pyproject.toml`):
```sh
docker compose run --rm --build update-lockfile
```
