aws-cdk-lib.aws_events.EventField

class EventField

LanguageType name
.NETAmazon.CDK.AWS.Events.EventField
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#EventField
Javasoftware.amazon.awscdk.services.events.EventField
Pythonaws_cdk.aws_events.EventField
TypeScript (source)aws-cdk-lib » aws_events » EventField

Implements IResolvable

Represents a field in the event pattern.

Example

import * as logs from 'aws-cdk-lib/aws-logs';
declare const logGroup: logs.LogGroup;
declare const rule: events.Rule;

rule.addTarget(new targets.CloudWatchLogGroup(logGroup, {
  logEvent: targets.LogGroupTargetInput.fromObject({
    timestamp: events.EventField.fromPath('$.time'),
    message: events.EventField.fromPath('$.detail-type'),
  }),
}));

Properties

NameTypeDescription
creationStackstring[]The creation stack of this resolvable which will be appended to errors thrown during resolution.
displayHintstringHuman readable display hint about the event pattern.
pathstringthe path to a field in the event pattern.
static accountstringExtract the account from the event.
static detailTypestringExtract the detail type from the event.
static eventIdstringExtract the event ID from the event.
static regionstringExtract the region from the event.
static sourcestringExtract the source from the event.
static timestringExtract the time from the event.

creationStack

Type: string[]

The creation stack of this resolvable which will be appended to errors thrown during resolution.

This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.


displayHint

Type: string

Human readable display hint about the event pattern.


path

Type: string

the path to a field in the event pattern.


static account

Type: string

Extract the account from the event.


static detailType

Type: string

Extract the detail type from the event.


static eventId

Type: string

Extract the event ID from the event.


static region

Type: string

Extract the region from the event.


static source

Type: string

Extract the source from the event.


static time

Type: string

Extract the time from the event.

Methods

NameDescription
resolve(_ctx)Produce the Token's value at resolution time.
toJSON()Convert the path to the field in the event pattern to JSON.
toString()Return a string representation of this resolvable object.
static fromPath(path)Extract a custom JSON path from the event.

resolve(_ctx)

public resolve(_ctx: IResolveContext): any

Parameters

  • _ctx IResolveContext

Returns

  • any

Produce the Token's value at resolution time.


toJSON()

public toJSON(): string

Returns

  • string

Convert the path to the field in the event pattern to JSON.


toString()

public toString(): string

Returns

  • string

Return a string representation of this resolvable object.

Returns a reversible string representation.


static fromPath(path)

public static fromPath(path: string): string

Parameters

  • path string

Returns

  • string

Extract a custom JSON path from the event.