From f785509021231c4fe3d42535ec5d47ed88625c56 Mon Sep 17 00:00:00 2001 From: Michael Sambol Date: Tue, 15 Oct 2024 10:19:49 -0700 Subject: [PATCH] Add other feedback Leonardo --- .../aws-pipes-targets-alpha/lib/cloudwatch-logs.ts | 7 ++++--- .../aws-pipes-targets-alpha/test/integ.cloudwatch-logs.ts | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/cloudwatch-logs.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/cloudwatch-logs.ts index 152bd8a834a58..93b25fe2daada 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/cloudwatch-logs.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/cloudwatch-logs.ts @@ -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 @@ -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; diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.cloudwatch-logs.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.cloudwatch-logs.ts index bb516806539f4..503dcbc3aee49 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.cloudwatch-logs.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.cloudwatch-logs.ts @@ -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'); @@ -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),