This file contains hidden or 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
import * as cdk from 'aws-cdk-lib'; | |
import * as pipelines from 'aws-cdk-lib/pipelines'; | |
import { Construct } from 'constructs'; | |
import { PipelineStage } from '../pipeline-stage/pipeline-stage'; | |
import { environments } from '../pipeline-config/pipeline-config'; | |
export class PipelineStack extends cdk.Stack { | |
constructor(scope: Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); |
This file contains hidden or 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
export interface EnvironmentConfig { | |
env: { | |
account: string; | |
region: string; | |
}; | |
stageName: string; | |
stateful: { | |
bucketName: string; | |
}; | |
stateless: { |
This file contains hidden or 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
import * as dotenv from 'dotenv'; | |
import { | |
Account, | |
EnvironmentConfig, | |
Region, | |
Stage, | |
} from '../pipeline-types/pipeline-types'; | |
dotenv.config(); |
This file contains hidden or 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
import * as apigw from 'aws-cdk-lib/aws-apigateway'; | |
import * as cdk from 'aws-cdk-lib'; | |
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; | |
import * as lambda from 'aws-cdk-lib/aws-lambda'; | |
import * as nodeLambda from 'aws-cdk-lib/aws-lambda-nodejs'; | |
import * as path from 'path'; | |
import * as s3 from 'aws-cdk-lib/aws-s3'; | |
import { Construct } from 'constructs'; |
This file contains hidden or 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
import * as cdk from 'aws-cdk-lib'; | |
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; | |
import * as s3 from 'aws-cdk-lib/aws-s3'; | |
import { Construct } from 'constructs'; | |
import { RemovalPolicy } from 'aws-cdk-lib'; | |
export interface StatefulStackProps extends cdk.StackProps { | |
bucketName: string; | |
} |
This file contains hidden or 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
import * as cdk from 'aws-cdk-lib'; | |
import { Construct } from 'constructs'; | |
import { EnvironmentConfig } from '../pipeline-types/pipeline-types'; | |
import { StatefulStack } from '../../app/stateful/stateful-stack'; | |
import { StatelessStack } from '../../app/stateless/stateless-stack'; | |
// this is our stage made up of multiple stacks which will be deployed to various environments | |
// based on config i.e. feature-dev, staging, prod, which also includes our application config | |
export class PipelineStage extends cdk.Stage { |
This file contains hidden or 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
import { AppSyncResolverEvent, AppSyncResolverHandler } from "aws-lambda"; | |
import { Customer } from "../../types"; | |
import { HttpRequest } from "@aws-sdk/protocol-http"; | |
import { URL } from "url"; | |
import fetch from "node-fetch"; | |
import { signRequest } from "../../helpers/request-signer"; | |
import { config } from "../../config"; | |
import { v4 as uuid } from "uuid"; |
This file contains hidden or 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
// create the orders connection for the api destination | |
const externalOrdersConnection: events.Connection = new events.Connection( | |
this, | |
'ExternalOrdersApiDestinationsConnection', | |
{ | |
authorization: events.Authorization.apiKey( | |
'x-api-key', | |
SecretValue.unsafePlainText('SuperSecretKey!12345') // this is for the demo only | |
), | |
description: 'External Orders API Destination Connection', |
This file contains hidden or 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
import * as AWS from 'aws-sdk'; | |
import { APIGatewayProxyHandler, APIGatewayProxyResult } from 'aws-lambda'; | |
import axios from 'axios'; | |
import { v4 as uuid } from 'uuid'; | |
const dynamoDb = new AWS.DynamoDB.DocumentClient(); | |
export const handler: APIGatewayProxyHandler = async ({ |