Skip to content

Commit

Permalink
Add other feedback Leonardo
Browse files Browse the repository at this point in the history
  • Loading branch information
msambol committed Oct 15, 2024
1 parent d668e3b commit f785509
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export interface CloudWatchLogsTargetParameters {
/**
* The JSON path expression that references the timestamp in the payload.
*
* @example
* '$.data.timestamp'
* This is the time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
*
* @example '$.data.timestamp'
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetcloudwatchlogsparameters.html#cfn-pipes-pipe-pipetargetcloudwatchlogsparameters-timestamp
* @default - current time
Expand All @@ -36,7 +37,7 @@ export interface CloudWatchLogsTargetParameters {
}

/**
* A EventBridge Pipes target that sends messages to a CloudWatch Logs log group.
* An EventBridge Pipes target that sends messages to a CloudWatch Logs log group.
*/
export class CloudWatchLogsTarget implements ITarget {
private logGroup: ILogGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { CloudWatchLogsTarget } from '../lib';

/*
* This integration test sends a message to an SQS queue and validates
* that the message is logged in the CloudWatch Logs log group.
*
* SQS (pipe source) --> CloudWatch Logs log group (pipe target)
*/

const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-pipes-targets-cwl');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
Expand Down Expand Up @@ -41,6 +48,7 @@ const logEvents = test.assertions.awsApiCall('CloudWatchLogs', 'filterLogEvents'

const message = putMessageOnQueue.next(logEvents);

// verify the message made it from the queue and is logged in the log group
message.assertAtPath('events.0.message', ExpectedResult.stringLikeRegexp(body)).waitForAssertions({
totalTimeout: cdk.Duration.minutes(1),
interval: cdk.Duration.seconds(15),
Expand Down

0 comments on commit f785509

Please sign in to comment.