feat: データ取り込みバケットに復号化済みのファイルを配置する対応

This commit is contained in:
shimoda.m@nds-tyo.co.jp 2022-06-21 18:53:05 +09:00
parent 800b024a51
commit 3ceb9fbb78
2 changed files with 20 additions and 2 deletions

4
.gitignore vendored
View File

@ -2,3 +2,7 @@ lambda/mbj-newdwh2021-staging-NoticeToSlack/package-lock.json
lambda/mbj-newdwh2021-staging-NoticeToSlack/node_modules/*
lambda/mbj-newdwh2021-staging-PublishFromLog/package-lock.json
lambda/mbj-newdwh2021-staging-PublishFromLog/node_modules/*
# Pythonの仮想環境
.venv
__pycache__

View File

@ -144,7 +144,21 @@ def handler(event, context):
except Exception as e:
logger.error(f'E-07-02 PGP暗号化ファイルのS3出力に失敗しました エラー内容{e}')
raise FileOutputException('E-07-02', EXTENSION_ERROR, e)
# 「⑥」で復号化したファイルをデータ取込用バケットに出力する
try:
copy_source = {
'Bucket': decrypt_bucket_name,
'Key': decrypt_file_key
}
import_file_folder = f'{s3_event.data_source_name}{DIRECTORY_TARGET}'
import_file_key = f'{import_file_folder}{decrypt_file_name}'
logger.info(f'I-07-06 復号化ファイル出力 ファイル名:{decrypt_file_name} 出力先:{import_file_folder}')
import_file_obj = s3_resource.Object(s3_event.bucket_name, import_file_key)
import_file_obj.copy(copy_source)
logger.info(f'I-07-07 復号化ファイルをS3に出力しました')
except Exception as e:
logger.error(f'E-07-03 復号化ファイルのS3出力に失敗しました エラー内容{e}')
raise FileOutputException('E-07-02', EXTENSION_ERROR, e)
# ⑧ 処理終了ログを出力する
logger.info('I-08-01 処理終了 SAPデータ復号処理')
except EncryptFileReadException as e: