# `delete_product` lambda

The `delete_product` lambda makes a REST call to `ows-product` to do a hard-delete of products by UPC. Its access is gated to a specific m2m identity.

## Quickstart

### Install [Poetry](https://python-poetry.org/docs/)/Dependencies

```shell
pip install poetry
make pip_dev
```

### Permissions

Use [`awsume`](https://awsu.me/) to configure your AWS permissions for the production environment. You can find more
information about this on Notion [here](https://www.notion.so/AWS-Access-f841b9dd815d4443a80e96a86c92cd2f#5618a9119254428e9baeada414767e85).

```shell
awsume prod
```

### Local Development

```shell
cp event.shadow.json event.json
```

Make changes, run dev:

```shell
make dev
```

### Local Development (Docker)

```shell
docker compose up --build &
docker compose restart function
curl -s --request POST \
  --url http://localhost:9000/2015-03-31/functions/function/invocations \
  --header 'Content-Type: application/json' \
  --data '{"upc": "196872928846"}' | python3 -m json.tool
```

### Linting

Linting uses [Ruff](https://docs.astral.sh/ruff/), and its configuration is defined in `pyproject.toml`.

```shell
make lint
```

### Formatting

Formatting also uses Ruff.

```shell
make fmt
```
