-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-cluster-kubectl-role
- Loading branch information
Showing
8 changed files
with
991 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
[ | ||
{ | ||
"Resources": { | ||
"MyTopic86869434": { | ||
"Type": "AWS::SNS::Topic", | ||
"Properties": { | ||
"TopicName": "topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"Resources": { | ||
"EchoServiceRoleBE28060B": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"Echo11F3FB29": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"ZipFile": "exports.handler = function handler(event, _context, callback) {\n /* eslint-disable no-console */\n console.log('====================================================');\n console.log(JSON.stringify(event, undefined, 2));\n console.log('====================================================');\n return callback(undefined, event);\n}" | ||
}, | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"EchoServiceRoleBE28060B", | ||
"Arn" | ||
] | ||
}, | ||
"Handler": "index.handler", | ||
"Runtime": "nodejs10.x" | ||
}, | ||
"DependsOn": [ | ||
"EchoServiceRoleBE28060B" | ||
] | ||
}, | ||
"EchoAllowInvokeTopicStackMyTopicC43E67AF32CF6EFA": { | ||
"Type": "AWS::Lambda::Permission", | ||
"Properties": { | ||
"Action": "lambda:InvokeFunction", | ||
"FunctionName": { | ||
"Fn::GetAtt": [ | ||
"Echo11F3FB29", | ||
"Arn" | ||
] | ||
}, | ||
"Principal": "sns.amazonaws.com", | ||
"SourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":sns:us-east-1:12345678:topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"EchoMyTopic4CB8819E": { | ||
"Type": "AWS::SNS::Subscription", | ||
"Properties": { | ||
"Protocol": "lambda", | ||
"TopicArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":sns:us-east-1:12345678:topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
] | ||
] | ||
}, | ||
"Endpoint": { | ||
"Fn::GetAtt": [ | ||
"Echo11F3FB29", | ||
"Arn" | ||
] | ||
}, | ||
"Region": "us-east-1" | ||
} | ||
} | ||
} | ||
} | ||
] |
35 changes: 35 additions & 0 deletions
35
packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as lambda from '@aws-cdk/aws-lambda'; | ||
import * as sns from '@aws-cdk/aws-sns'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as subs from '../lib'; | ||
|
||
/// !cdk-integ * | ||
const app = new cdk.App(); | ||
|
||
const topicStack = new cdk.Stack(app, 'TopicStack', { | ||
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' }, | ||
}); | ||
const topic = new sns.Topic(topicStack, 'MyTopic', { | ||
topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, | ||
}); | ||
|
||
const functionStack = new cdk.Stack(app, 'FunctionStack', { | ||
env: { region: 'us-east-2' }, | ||
}); | ||
const fction = new lambda.Function(functionStack, 'Echo', { | ||
handler: 'index.handler', | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), | ||
}); | ||
|
||
topic.addSubscription(new subs.LambdaSubscription(fction)); | ||
|
||
app.synth(); | ||
|
||
function handler(event: any, _context: any, callback: any) { | ||
/* eslint-disable no-console */ | ||
console.log('===================================================='); | ||
console.log(JSON.stringify(event, undefined, 2)); | ||
console.log('===================================================='); | ||
return callback(undefined, event); | ||
} |
90 changes: 90 additions & 0 deletions
90
packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
[ | ||
{ | ||
"Resources": { | ||
"MyTopic86869434": { | ||
"Type": "AWS::SNS::Topic", | ||
"Properties": { | ||
"TopicName": "topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"Resources": { | ||
"MyQueueE6CA6235": { | ||
"Type": "AWS::SQS::Queue", | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"MyQueuePolicy6BBEDDAC": { | ||
"Type": "AWS::SQS::QueuePolicy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sqs:SendMessage", | ||
"Condition": { | ||
"ArnEquals": { | ||
"aws:SourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":sns:us-east-1:12345678:topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "sns.amazonaws.com" | ||
}, | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"MyQueueE6CA6235", | ||
"Arn" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"Queues": [ | ||
{ | ||
"Ref": "MyQueueE6CA6235" | ||
} | ||
] | ||
} | ||
}, | ||
"MyQueueTopicStackMyTopicC43E67AFC8DC8B4A": { | ||
"Type": "AWS::SNS::Subscription", | ||
"Properties": { | ||
"Protocol": "sqs", | ||
"TopicArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":sns:us-east-1:12345678:topicstackopicstackmytopicc43e67afb24f28bb94f9" | ||
] | ||
] | ||
}, | ||
"Endpoint": { | ||
"Fn::GetAtt": [ | ||
"MyQueueE6CA6235", | ||
"Arn" | ||
] | ||
}, | ||
"Region": "us-east-1" | ||
} | ||
} | ||
} | ||
} | ||
] |
25 changes: 25 additions & 0 deletions
25
packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as sns from '@aws-cdk/aws-sns'; | ||
import * as sqs from '@aws-cdk/aws-sqs'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as subs from '../lib'; | ||
|
||
/// !cdk-integ * | ||
const app = new cdk.App(); | ||
|
||
/// !show | ||
const topicStack = new cdk.Stack(app, 'TopicStack', { | ||
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' }, | ||
}); | ||
const topic = new sns.Topic(topicStack, 'MyTopic', { | ||
topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, | ||
}); | ||
|
||
const queueStack = new cdk.Stack(app, 'QueueStack', { | ||
env: { region: 'us-east-2' }, | ||
}); | ||
const queue = new sqs.Queue(queueStack, 'MyQueue'); | ||
|
||
topic.addSubscription(new subs.SqsSubscription(queue)); | ||
/// !hide | ||
|
||
app.synth(); |
Oops, something went wrong.