Skip to content

Commit

Permalink
Merge branch 'main' into addEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 2, 2024
2 parents e6deeca + e3300f0 commit e44239b
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const table = new ddb.TableV2(stack, 'MyTable', {
const dlqQueue = new cdk.aws_sqs.Queue(stack, 'DlqQueue');
const targetQueue = new cdk.aws_sqs.Queue(stack, 'TargetQueue');

// When this module is promoted from alpha, TestTarget should
// be replaced with SqsTarget from @aws-cdk/aws-pipes-targets-alpha
class TestTarget implements ITarget {
targetArn: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const stack = new cdk.Stack(app, 'aws-cdk-pipes-sources-kinesis');
const sourceKinesisStream = new cdk.aws_kinesis.Stream(stack, 'SourceKinesisStream');
const targetQueue = new cdk.aws_sqs.Queue(stack, 'TargetQueue');

// When this module is promoted from alpha, TestTarget should
// be replaced with SqsTarget from @aws-cdk/aws-pipes-targets-alpha
class TestTarget implements ITarget {
targetArn: string;

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-pipes-sources-alpha/test/integ.sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const stack = new cdk.Stack(app, 'aws-cdk-pipes-sources-sqs');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
const targetQueue = new cdk.aws_sqs.Queue(stack, 'TargetQueue');

// When this module is promoted from alpha, TestTarget should
// be replaced with SqsTarget from @aws-cdk/aws-pipes-targets-alpha
class TestTarget implements ITarget {
targetArn: string;
inputTransformation: InputTransformation = InputTransformation.fromEventPath('$.body');
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-pipes-targets-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
"aws-cdk-lib": "0.0.0",
"constructs": "^10.0.0",
"@aws-cdk/aws-pipes-alpha": "0.0.0",
"@aws-cdk/integ-tests-alpha": "0.0.0",
"@aws-cdk/aws-pipes-sources-alpha": "0.0.0"
"@aws-cdk/integ-tests-alpha": "0.0.0"
},
"dependencies": {},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2';
Expand All @@ -19,6 +18,25 @@ const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
* --> API Gateway HTTP API --> Lambda function
*/

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

const fn = new lambda.Function(stack, 'ConnectHandler', {
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
Expand Down Expand Up @@ -53,7 +71,7 @@ const destination = new cdk.aws_events.ApiDestination(stack, 'MyDestination', {
});

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new ApiDestinationTarget(destination, {
headerParameters: {
'x-header': 'myheader',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InputTransformation, Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { InputTransformation, IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { CloudWatchLogsTarget } from '../lib';
Expand All @@ -18,13 +17,32 @@ const targetLogGroup = new cdk.aws_logs.LogGroup(stack, 'TargetLogGroup');
const logStreamName = 'Mexico';
const body = 'Cozumel';

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

new cdk.aws_logs.LogStream(stack, 'TargetLogStream', {
logGroup: targetLogGroup,
logStreamName: logStreamName,
});

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new CloudWatchLogsTarget(targetLogGroup, {
logStreamName,
inputTransformation: InputTransformation.fromEventPath('$.body'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { EventBridgeTarget } from '../lib/event-bridge';
Expand All @@ -9,8 +8,27 @@ const stack = new cdk.Stack(app, 'aws-cdk-pipes-targets-event-bridge');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
const targetEventBus = new cdk.aws_events.EventBus(stack, 'TargetEventBus');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new EventBridgeTarget(targetEventBus, {}),
});

Expand Down
24 changes: 21 additions & 3 deletions packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.kinesis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { KinesisTarget } from '../lib/kinesis';
Expand All @@ -9,8 +8,27 @@ const stack = new cdk.Stack(app, 'aws-cdk-pipes-targets-kinesis');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
const targetStream = new cdk.aws_kinesis.Stream(stack, 'TargetStream');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new KinesisTarget(targetStream, {
partitionKey: 'pk',
}),
Expand Down
24 changes: 21 additions & 3 deletions packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.lambda.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { randomUUID } from 'crypto';
import * as path from 'path';
import { Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import * as iam from 'aws-cdk-lib/aws-iam';
Expand All @@ -20,6 +19,25 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-pipes-lambda-target');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

const functionName = 'TestCdkPipesTargetLambdaFunction';
const targetFunction = new lambda.Function(stack, 'TargetLambdaFunction', {
code: lambda.AssetCode.fromAsset(
Expand All @@ -40,7 +58,7 @@ targetFunction.addToRolePolicy(
);

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new LambdaFunction(targetFunction, {}),
});

Expand Down
25 changes: 21 additions & 4 deletions packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sagemaker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Pipe } from '@aws-cdk/aws-pipes-alpha';
// eslint-disable-next-line import/no-extraneous-dependencies
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import * as iam from 'aws-cdk-lib/aws-iam';
Expand All @@ -20,6 +18,25 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-pipes-targets-sagemaker');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

interface FakePipelineProps {
readonly pipelineName: string;
}
Expand Down Expand Up @@ -122,7 +139,7 @@ const targetPipeline = new FakePipeline(stack, 'Pipeline', {
});

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new SageMakerTarget(targetPipeline, {
pipelineParameters: {
foor: 'bar',
Expand Down
24 changes: 21 additions & 3 deletions packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sqs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { randomUUID } from 'crypto';
import { InputTransformation, Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { InputTransformation, IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { SqsTarget } from '../lib';
Expand All @@ -10,8 +9,27 @@ const stack = new cdk.Stack(app, 'aws-cdk-pipes-targets');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');
const targetQueue = new cdk.aws_sqs.Queue(stack, 'TargetQueue');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new SqsTarget(targetQueue,
{
inputTransformation: InputTransformation.fromEventPath('$.body'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InputTransformation, Pipe } from '@aws-cdk/aws-pipes-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import { InputTransformation, IPipe, ISource, Pipe, SourceConfig } from '@aws-cdk/aws-pipes-alpha';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import * as ssm from 'aws-cdk-lib/aws-ssm';
Expand All @@ -16,6 +15,26 @@ import { SfnStateMachine } from '../lib/stepfunctions';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-pipes-sfn-target');
const sourceQueue = new cdk.aws_sqs.Queue(stack, 'SourceQueue');

// When this module is promoted from alpha, TestSource should
// be replaced with SqsSource from @aws-cdk/aws-pipes-sources-alpha
class TestSource implements ISource {
sourceArn: string;
sourceParameters = undefined;
constructor(private readonly queue: cdk.aws_sqs.Queue) {
this.queue = queue;
this.sourceArn = queue.queueArn;
}
bind(_pipe: IPipe): SourceConfig {
return {
sourceParameters: this.sourceParameters,
};
}
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
}

const parameterName = 'MyPipeParameter';
new ssm.StringParameter(stack, 'MyParameter', {
parameterName,
Expand All @@ -38,7 +57,7 @@ const targetStateMachine = new sfn.StateMachine(stack, 'TargetStateMachine', {
});

new Pipe(stack, 'Pipe', {
source: new SqsSource(sourceQueue),
source: new TestSource(sourceQueue),
target: new SfnStateMachine(targetStateMachine,
{
inputTransformation: InputTransformation.fromObject({ body: '<$.body>' }),
Expand Down

0 comments on commit e44239b

Please sign in to comment.