add send cert reporting

This commit is contained in:
2025-10-12 01:09:40 -03:00
parent c9438d49fb
commit 8d10f55ad2
20 changed files with 435 additions and 55 deletions

View File

@@ -21,10 +21,10 @@ dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
old_image = event.detail['old_image']
now_ = now()
issued_cert = dyn.collection.get_item(
cert = dyn.collection.get_item(
KeyPair(
pk=old_image['id'],
sk=SortKey('0', path_spec='issued_cert'),
sk=SortKey('0', path_spec='cert'),
),
raise_on_error=False,
default={},
@@ -37,12 +37,11 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
pk=old_image['id'],
sk='0',
),
update_expr='SET issued_cert = :issued_cert, \
updated_at = :now',
update_expr='SET cert = :cert, updated_at = :now',
cond_expr='#status = :completed',
expr_attr_names={'#status': 'status'},
expr_attr_values={
':issued_cert': issued_cert | {'expired': True},
':cert': cert | {'expired': True},
':completed': 'COMPLETED',
':now': now_,
},