This commit is contained in:
Michaela Wheeler 2021-12-20 18:13:24 +11:00
parent 512e366607
commit ae77f0e933
32 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,6 @@
resource "aws_lambda_function" "upload_telem" {
function_name = "sonde-api-to-iot-core"
handler = "sonde-api-to-iot-core.lambda_handler"
handler = "sonde_api_to_iot_core.lambda_handler"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true
@ -18,7 +18,7 @@ resource "aws_lambda_function" "upload_telem" {
resource "aws_lambda_function" "station" {
function_name = "station-api-to-iot-core"
handler = "station-api-to-iot-core.lambda_handler"
handler = "station_api_to_iot_core.lambda_handler"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true

View File

@ -49,9 +49,12 @@ def fetch_es(serial):
scroll_ids.append(scroll_id)
data += [x["_source"] for x in response['hits']['hits']]
for scroll_id in scroll_ids:
scroll_delete = es.request(json.dumps({"scroll_id": scroll_id }),
"_search/scroll", "DELETE")
print(scroll_delete)
try:
scroll_delete = es.request(json.dumps({"scroll_id": scroll_id }),
"_search/scroll", "DELETE")
print(scroll_delete)
except RuntimeError:
pass
return data
def fetch_s3(serial):

View File

@ -5,7 +5,7 @@ print(handler(
{
"messageId": "3b5853b3-369c-40bf-8746-130c918fbb5c",
"receiptHandle": "AQEBg+/MIA2rSNmlrpXvk7pbi26kgIzqhairaHWGSpMgLzf2T54PLUmG+eG6CDOv35e42scDH0gppmS9RTQVu8D161oHYohhd1+0S4LtFJdgXr3At86NBIky5+y1A/wVuUm1FNQSvGKIDRgBhCgcCzLkEMNYIWWeDmg2ez2SCPu/3hmY5sc7eC32uqz5es9PspgQXOTykmoNv/q37iy2RBRDdu51Tq7yIxEr+Us3qkQrddAJ7qsA0l09aRL+/PJe1V/7MMN3CFyBATpRP/G3Gjn0Iuu4i2UhkRx2pF+0Hj8yhhHbqTMcw5sbbGIWMdsMXFQKUCHNx6HPkbuwIWo0TsINQjY7IXeZM/mNq65xC4avSlctJ/9BMzOBtFwbnRPZfHmlS5Al2nF1Vu3RecFGbTm1nQ==",
"body": "R0230678",
"body": "T1310402",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1627873604999",

View File

@ -1,5 +1,6 @@
import boto3
import json
import botocore.exceptions
from datetime import datetime, timedelta, timezone
import uuid
import es

View File

@ -1,6 +1,6 @@
from . import *
print(
history(
{"pathParameters": {"serial": "T1510227"}}, {}
{"pathParameters": {"serial": "T1510227a"}}, {}
)
)

View File

@ -163,7 +163,7 @@ resource "aws_lambda_permission" "predictions" {
resource "aws_lambda_function" "reverse_predictions" {
function_name = "reverse-predictions"
handler = "reverse-predict.predict"
handler = "reverse_predict.predict"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true
@ -658,7 +658,7 @@ EOF
resource "aws_lambda_function" "predictor_update_trigger_lambda" {
function_name = "tawhiri-updater"
handler = "tawhiri-updater.handler"
handler = "tawhiri_updater.handler"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true

View File

@ -56,7 +56,7 @@ EOF
resource "aws_lambda_function" "sqs_to_elk" {
function_name = "sqs-to-elk"
handler = "sqs-to-elk.lambda_handler"
handler = "sqs_to_elk.lambda_handler"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true

View File

@ -25,7 +25,7 @@ EOF
resource "aws_lambda_function" "sign_socket" {
function_name = "sign-websocket"
handler = "sign-websocket.lambda_handler"
handler = "sign_websocket.lambda_handler"
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256
publish = true