sns_event

SNS event handling in Lambda function.

aws_ci_bot.sns_event.extract_sns_message_dict(event: dict) dict[source]

Extract the AWS CodeStar notification event from the received Lambda event. Lambda event includes the SNS message body, and the SNS message body includes the AWS CodeStar notification event.

Parameters

event – the original lambda function input payload

Returns

the AWS CodeStar notification event data in dict

aws_ci_bot.sns_event.encode_partition_key(dt: datetime.datetime) str[source]

Figure out the s3 partition part based on the given datetime.

aws_ci_bot.sns_event.upload_ci_event(s3_client, event_dict: dict, event_obj: Union[aws_codecommit.notification.CodeCommitEvent, aws_codebuild.notification.CodeBuildEvent], bucket: str, prefix: str, verbose: bool = True) str[source]

Upload CI/CD lambda event to S3 as a backup.

Parameters
  • s3_client

  • event_dict

  • event_obj

  • bucket

  • prefix

  • verbose

Returns

the S3 uri where the event is uploaded