Class CloudWatchEvent
- java.lang.Object
-
- com.perihelios.aws.lambda.cloudwatch.dispatcher.event.CloudWatchEvent
-
public class CloudWatchEvent extends Object
Base class of all CloudWatch events.CloudWatch events are delivered to AWS Lambda functions as JSON documents. There are a small number of top-level properties in the JSON; these are mostly metadata, and are unmarshalled into the
Header, obtainable viaheader(). The event proper is contained in thedetailproperty, with thedetail-typeproperty providing a way to identify what properties may be expected indetail.Subclasses should always be annotated with
DetailType, as this is the only mechanism to indicate to which subclass an event should be unmarshalled. Assume an event such as this is received by an AWS Lambda:{ ... "detail-type": "Some Service Event", "detail": { "blah": "some value", "foo": 17 } ... }A proper class to which to unmarshal this event might look like this:
@DetailType("Some Service Event") class MyCustomEvent extends CloudWatchEvent { private String blah; private int foo; String blah() { return blah; } int foo() { return foo; } }Note that
MyCustomEventwould also need to be registered withCloudWatchEventDispatcher.withEventHandler()in order to be used during event dispatch.
-
-
Constructor Detail
-
CloudWatchEvent
public CloudWatchEvent()
-
-