# slz_meta_retrigger lambda
This lambda retrigger MetaFlow for FAILED meta content statuses. It works similar to slz_job_manager, but for MetaFlow.
By default this lambda starts daily by CW event. But also we have the opportunity to start it manually at the context level, passing the "retriggering" payload to the event(see below).

## Lambda Environment variables
To execute the Meta Retrigger Lambda the following environment variables must be configured:

| Variable                      | Description                                                    |
|-------------------------------|----------------------------------------------------------------|
| `ENVIRONMENT`                 | Environment name (`qa`, `dev`, `stage`, `prod`).               |
| `CONTENT_STATUS_TABLE_NAME`   | Table name for content statuses in Dynamo DB.                  |
| `RDS_SECRETS_KEY`             | Postgres DB secret key name.                                   |
| `CONFIG_BUCKET`               | Name of S3 bucket with config files.                           |
| `DSP_SETTINGS_PATH`           | Path to dsp-specific-settings.json config file on S3.          |
| `BUCKET_DECOMPRESSED`         | Name of S3 bucket with decompressed report files.              |
| `SQS_ARNS`                    | SQS ARNs list.                                                 |
| `MIGRATION_STAGE`             | Current migration stage.                                       |
| `RETRIGGERING_TRESHOLD`       | Retriggering threshold timedelta(optional, 30 days by default) |


## Lambda Event
Event example:
```json
{
    "id": "cdc73f9d-aea9-11e3-9d5a-835b769c0d9c",
    "detail-type": "Scheduled Event",
    "source": "aws.events",
    "account": "{{{account-id}}}",
    "time": "2020-02-25T10:00:00Z",
    "region": "us-east-1",
    "resources": [
        "arn:aws:events:us-east-1:123456789012:rule/ExampleRule"
    ],
    "detail": {}
}
```

## Lambda Input
This lambda does not have any required input data. The only one exception is a manual retriggering of specific items. In order to start lambda in this mode, list of UOW ids and their contexts must be specified. Here is the example input data structure(add it to event):
```json
"retriggering": [
    {
        "uow_id": "apple-20190109-smejp-amArtistDemographics-v1_0",
        "context": "4::86875390"
    },
    {
        "uow_id": "vevo-20200210-sme-SonyStandardSales-v1",
        "context": "SonyStandardSales"
    }
]
```


## Lambda Output
In case of successful lambda execution the following output will be provided:
```json
{
    "meta": {
        "status": "OK"
    }
}
```
