class EventField
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.EventField |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#EventField |
![]() | software.amazon.awscdk.services.events.EventField |
![]() | aws_cdk.aws_events.EventField |
![]() | 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
Name | Type | Description |
---|---|---|
creation | string[] | The creation stack of this resolvable which will be appended to errors thrown during resolution. |
display | string | Human readable display hint about the event pattern. |
path | string | the path to a field in the event pattern. |
static account | string | Extract the account from the event. |
static detail | string | Extract the detail type from the event. |
static event | string | Extract the event ID from the event. |
static region | string | Extract the region from the event. |
static source | string | Extract the source from the event. |
static time | string | Extract 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
Name | Description |
---|---|
resolve(_ctx) | Produce the Token's value at resolution time. |
to | Convert the path to the field in the event pattern to JSON. |
to | Return a string representation of this resolvable object. |
static from | Extract a custom JSON path from the event. |
resolve(_ctx)
public resolve(_ctx: IResolveContext): any
Parameters
- _ctx
IResolve
Context
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.