-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace CdkPipeline construct with vanilla Pipeline construct
The former doesn't support lambdas with code in another repository: aws/aws-cdk#13600
- Loading branch information
Showing
6 changed files
with
111 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ node_modules | |
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
dist |
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/usr/bin/env node | ||
import 'source-map-support/register'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import { TelegramCommandHandlerStack } from '../lib/stack/pipeline-stack'; | ||
import { PipelineStack } from '../lib/stack/pipeline-stack'; | ||
import { TelegramCommandHandlerStack } from '../lib/stack/telegram-handler-stack' | ||
|
||
const app = new cdk.App(); | ||
new TelegramCommandHandlerStack(app, 'TelegramCommandHandlerStack', { | ||
env: {region: 'us-west-2'} | ||
const telegramCommandHandlerStack = new TelegramCommandHandlerStack(app, 'TelegramCommandHandlerStack'); | ||
new PipelineStack(app, 'PipelineStack', { | ||
env: {region: 'us-west-2'}, | ||
pkmnQuizBotCode: telegramCommandHandlerStack.pkmnQuizBotCode | ||
}); | ||
|
||
app.synth(); |
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,16 @@ | ||
version: 0.2 | ||
|
||
phases: | ||
install: | ||
commands: | ||
npm install | ||
build: | ||
on-failure: ABORT | ||
commands: | ||
- npm run build | ||
- npm run cdk synth -- -o dist | ||
|
||
artifacts: | ||
base-directory: dist | ||
files: | ||
- LambdaStack.template.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
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 |
---|---|---|
@@ -1,26 +1,20 @@ | ||
import * as apigw from '@aws-cdk/aws-apigateway'; | ||
import * as lambda from '@aws-cdk/aws-lambda'; | ||
import { CfnOutput, Construct, Stack, StackProps } from '@aws-cdk/core'; | ||
import * as path from 'path'; | ||
import { Construct, Stack, StackProps } from '@aws-cdk/core'; | ||
|
||
/** | ||
* A stack for our simple Lambda-powered web service | ||
*/ | ||
export class LambdaStack extends Stack { | ||
/** | ||
* The URL of the API Gateway endpoint, for use in the integ tests | ||
*/ | ||
public readonly urlOutput: CfnOutput; | ||
|
||
|
||
export class TelegramCommandHandlerStack extends Stack { | ||
public readonly pkmnQuizBotCode: lambda.CfnParametersCode; | ||
|
||
constructor(scope: Construct, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
// The Lambda function that contains the functionality | ||
const handler = new lambda.Function(this, 'Lambda', { | ||
runtime: lambda.Runtime.NODEJS_12_X, | ||
handler: 'handler.handler', | ||
code: lambda.Code.fromAsset(path.resolve(__dirname, 'lambda')), | ||
|
||
this.pkmnQuizBotCode = lambda.Code.fromCfnParameters(); | ||
|
||
const pkmnQuizBotLambda = new lambda.Function(this, 'Lambda', { | ||
runtime: lambda.Runtime.GO_1_X, | ||
handler: 'main', | ||
code: this.pkmnQuizBotCode, | ||
}); | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { CfnOutput, Construct, Stage, StageProps } from '@aws-cdk/core'; | ||
import { LambdaStack } from '../stack/telegram-handler-stack'; | ||
import { TelegramCommandHandlerStack } from '../stack/telegram-handler-stack'; | ||
|
||
/** | ||
* Deployable unit of web service app | ||
*/ | ||
export class ProdStage extends Stage { | ||
public readonly urlOutput: CfnOutput; | ||
export class TelegramCommandHandlerStage extends Stage { | ||
|
||
constructor(scope: Construct, id: string, props?: StageProps) { | ||
super(scope, id, props); | ||
|
||
const service = new LambdaStack(this, 'LambdaStack'); | ||
const service = new TelegramCommandHandlerStack(this, 'TelegramCommandHandlerStack'); | ||
|
||
} | ||
} |