You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The input transformation supported by eventRule.addTarget(target, inputTransformation) requires deep knowledge of how source events look.
For example, to trigger an SNS topic every time an EC2 instance changes its state, users currently need to write:
constinstance=newec2.Instance(this,'MyInstance');instance.onStateChange().addTarget(topic,{textTemplate: 'Instance <instance> changed state to <state>',pathsMap: {state: '$.detail.state',instance : '$.detail.instance-id'}});
This means that users must know exactly how an "EC2 Instance State-change Notification" looks like. Ideally that should be an implementation detail of the ec2.Instance class.
Wouldn't it be great though if we could do something like:
instance.onStateChange().addTarget(topic,{textTemplate: 'Instance <instance> changed state to <state>',pathsMap: {state: StateChangeEvent.detail.state,instance : StateChangeEvent.detail.instanceId}});
Where I both
a) discover what fields are available; and
b) can't make mistakes.
Obviously, now I need to know I need to instantiate a StateChangeEvent, but even that could be fixed like so:
instance.onStateChange().addTarget(topic,{textTemplate: 'Instance <instance> changed state to <state>',}).substituting(event=>({state: event.detail.state,instance: event.detail.instanceId}));
The input transformation supported by
eventRule.addTarget(target, inputTransformation)
requires deep knowledge of how source events look.For example, to trigger an SNS topic every time an EC2 instance changes its state, users currently need to write:
This means that users must know exactly how an "EC2 Instance State-change Notification" looks like. Ideally that should be an implementation detail of the
ec2.Instance
class.See #27 for context
The text was updated successfully, but these errors were encountered: