eventbridge
Lambda event
- class awsmate.eventbridge.LambdaBridgePutEvent(event_object: dict)
Bases:
LambdaEventMapping of the input event received by an AWS Lambda function triggered by AWS EventBridge.
Warning
AWS EventBridge can be configured in Universal Target mode, which allows passing the target arbitrary event objects instead of standard ones.
LambdaBridgePutEventis not designed to handle such events as they do not comply to the AWS EventBridge events specifications. The PutEvents format is the only handled.- Parameters:
event_object (dict) – The parameter
eventreceived by the AWS Lambda function handler.- Raises:
TypeError – If
event_objectis not adict.
Examples
>>> def lambda_handler(raw_event, context): >>> from awsmate.eventbridge import LambdaBridgePutEvent >>> event = LambdaBridgePutEvent(raw_event)
- detail_type() str
Returns a readable explanation of the type of this event.
This explanation is returned as transmitted by AWS EventBridge.
- Returns:
The detail of the type.
- Return type:
str
- Raises:
awsmate.lambdafunction.AwsEventSpecificationError – If the event structure does not allow retrieving this piece of information.
Examples
>>> event.detail_type() 'RDS DB Instance Event'
- source() str
Returns the name of the AWS service that triggered this event.
This name is returned as transmitted by AWS EventBridge.
- Returns:
The name of the source AWS service.
- Return type:
str
- Raises:
awsmate.lambdafunction.AwsEventSpecificationError – If the event structure does not allow retrieving this service.
Examples
>>> event.source() 'aws.rds'
- detail() Any
Returns the AWS-service-specific details of this event.
The structure of the returned data varies depending on the service that triggers the event.
- Returns:
The detail of this event as submitted by the service that triggered it.
- Return type:
any
- Raises:
awsmate.lambdafunction.AwsEventSpecificationError – If the event structure does not allow retrieving this detail, or if cannot be JSON deserialized.
Examples
>>> event.detail() {'EventCategories': ['backup'], 'SourceType': 'DB_INSTANCE', 'SourceArn': 'arn:aws:rds:us-east-1:123456789012:db:rdz0a1b2c3d4e5', 'Date': '2023-04-03T07:20:20.112Z', 'Message': 'Finished DB Instance backup', 'SourceIdentifier': 'rdz0a1b2c3d4e5'}