@byaga/cdk-patterns 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/archive/ApiAttachPoint.ts +9 -0
- package/archive/ApiCertificate.ts +32 -0
- package/{lib/CognitoApiGatewayAuthorizer.d.ts → archive/CognitoApiGatewayAuthorizer.ts} +13 -7
- package/archive/DynamoDbTable.ts +40 -0
- package/archive/ICorsConfig.ts +5 -0
- package/archive/IDomainConfig.ts +8 -0
- package/archive/IHostedZoneConfig.ts +5 -0
- package/archive/NodeJsLambdaLayer.ts +42 -0
- package/archive/Output.ts +11 -0
- package/{lib/RestApi.js → archive/RestApi.ts} +96 -60
- package/{lib/Role.d.ts → archive/Role.ts} +165 -139
- package/archive/StaticWebSite.ts +159 -0
- package/archive/index.ts +18 -0
- package/archive/methods/apply-schema-to-method-options.ts +38 -0
- package/archive/methods/attach-function-to-api.ts +69 -0
- package/lib/{methods → build}/copy-files.js +1 -1
- package/lib/{methods → build/nodejs}/build-ecmascript.d.ts +2 -2
- package/lib/{methods → build/nodejs}/build-ecmascript.js +5 -5
- package/lib/{methods → build/nodejs}/build-node-source.d.ts +3 -1
- package/lib/{methods → build/nodejs}/build-node-source.js +6 -6
- package/lib/{methods → build/nodejs}/build-typescript.d.ts +2 -2
- package/lib/{methods → build/nodejs}/build-typescript.js +5 -5
- package/lib/{methods → build/nodejs}/install-node-modules.js +1 -1
- package/lib/create-stack.d.ts +41 -0
- package/lib/create-stack.js +48 -0
- package/lib/generate-identifier.d.ts +27 -0
- package/lib/generate-identifier.js +65 -0
- package/lib/index.d.ts +8 -15
- package/lib/index.js +40 -25
- package/lib/lambda/create-function.d.ts +20 -0
- package/lib/lambda/create-function.js +39 -0
- package/lib/lambda/create-nodejs-lambda.d.ts +28 -0
- package/lib/lambda/create-nodejs-lambda.js +38 -0
- package/lib/lambda-layer/apply-honeycomb-to-lambda.d.ts +2 -0
- package/lib/lambda-layer/apply-honeycomb-to-lambda.js +25 -0
- package/lib/lambda-layer/get-layer.d.ts +2 -0
- package/lib/lambda-layer/get-layer.js +20 -0
- package/lib/lambda-layer/layer-cache.d.ts +3 -0
- package/lib/lambda-layer/layer-cache.js +12 -0
- package/lib/load-configuration.d.ts +12 -0
- package/lib/load-configuration.js +42 -0
- package/lib/ssm/SsmParameter.d.ts +12 -0
- package/lib/ssm/get-existing-parameter.d.ts +9 -0
- package/lib/ssm/get-existing-parameter.js +41 -0
- package/lib/ssm/grant-read.d.ts +7 -0
- package/lib/ssm/grant-read.js +24 -0
- package/lib/ssm/index.d.ts +3 -0
- package/lib/ssm/index.js +9 -0
- package/lib/ssm/parameter-cache.d.ts +13 -0
- package/lib/ssm/parameter-cache.js +23 -0
- package/lib/ssm/string-value.d.ts +8 -0
- package/lib/ssm/string-value.js +14 -0
- package/package.json +4 -3
- package/lib/ApiCertificate.d.ts +0 -10
- package/lib/ApiCertificate.js +0 -31
- package/lib/CognitoApiGatewayAuthorizer.js +0 -24
- package/lib/DeployStack.d.ts +0 -19
- package/lib/DeployStack.js +0 -57
- package/lib/DynamoDbTable.d.ts +0 -12
- package/lib/DynamoDbTable.js +0 -34
- package/lib/FunctionIntegration.d.ts +0 -25
- package/lib/FunctionIntegration.js +0 -65
- package/lib/ICorsConfig.d.ts +0 -5
- package/lib/IDomainConfig.d.ts +0 -7
- package/lib/IDomainConfig.js +0 -2
- package/lib/IHostedZoneConfig.d.ts +0 -5
- package/lib/IHostedZoneConfig.js +0 -2
- package/lib/IStackArguments.d.ts +0 -8
- package/lib/IStackArguments.js +0 -2
- package/lib/NodeJsLambda.d.ts +0 -35
- package/lib/NodeJsLambda.js +0 -44
- package/lib/NodeJsLambdaLayer.d.ts +0 -25
- package/lib/NodeJsLambdaLayer.js +0 -35
- package/lib/Output.d.ts +0 -5
- package/lib/Output.js +0 -13
- package/lib/RestApi.d.ts +0 -28
- package/lib/Role.js +0 -27
- package/lib/SsmParameter.d.ts +0 -18
- package/lib/SsmParameter.js +0 -40
- package/lib/StaticWebSite.d.ts +0 -33
- package/lib/StaticWebSite.js +0 -136
- package/lib/methods/BuildOptions.d.ts +0 -3
- package/lib/methods/BuildOptions.js +0 -2
- package/lib/methods/apply-honeycomb-to-lambda.d.ts +0 -3
- package/lib/methods/apply-honeycomb-to-lambda.js +0 -23
- /package/lib/{methods → build}/copy-files.d.ts +0 -0
- /package/lib/{methods → build}/generate-hash.d.ts +0 -0
- /package/lib/{methods → build}/generate-hash.js +0 -0
- /package/lib/{methods → build}/get-files.d.ts +0 -0
- /package/lib/{methods → build}/get-files.js +0 -0
- /package/lib/{methods → build}/get-source-directory.d.ts +0 -0
- /package/lib/{methods → build}/get-source-directory.js +0 -0
- /package/lib/{methods → build}/hash-file.d.ts +0 -0
- /package/lib/{methods → build}/hash-file.js +0 -0
- /package/lib/{methods → build/nodejs}/install-node-modules.d.ts +0 -0
- /package/lib/{ICorsConfig.js → ssm/SsmParameter.js} +0 -0
- /package/lib/{methods → tools}/duration.d.ts +0 -0
- /package/lib/{methods → tools}/duration.js +0 -0
package/lib/NodeJsLambdaLayer.js
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.NodeJsLambdaLayer = void 0;
|
7
|
-
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
8
|
-
const build_node_source_1 = require("./methods/build-node-source");
|
9
|
-
const duration_1 = __importDefault(require("./methods/duration"));
|
10
|
-
/**
|
11
|
-
* Class representing a Node.js AWS Lambda layer.
|
12
|
-
* Extends the LayerVersion class from the AWS CDK library.
|
13
|
-
*/
|
14
|
-
class NodeJsLambdaLayer extends aws_lambda_1.LayerVersion {
|
15
|
-
/**
|
16
|
-
* Constructs a new NodeJsLambdaLayer instance.
|
17
|
-
* @param {DeployStack} stack - The deployment stack.
|
18
|
-
* @param {string} id - The ID of the layer.
|
19
|
-
* @param {NodeJsLambdaLayerProps} props - The properties of the layer.
|
20
|
-
*/
|
21
|
-
constructor(stack, id, props = {}) {
|
22
|
-
console.log("Building Lambda Layer", id);
|
23
|
-
const done = (0, duration_1.default)();
|
24
|
-
const buildDir = (0, build_node_source_1.buildNodeSource)('lambda-layer', id, { subdirectory: 'nodejs' });
|
25
|
-
console.log('Build Duration (ms)', done());
|
26
|
-
super(stack, stack.genId(id), {
|
27
|
-
compatibleRuntimes: [aws_lambda_1.Runtime.NODEJS_20_X],
|
28
|
-
...props,
|
29
|
-
layerVersionName: stack.genName(id),
|
30
|
-
code: aws_lambda_1.Code.fromAsset(buildDir),
|
31
|
-
});
|
32
|
-
stack.set('lambda-layer', id, this);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
exports.NodeJsLambdaLayer = NodeJsLambdaLayer;
|
package/lib/Output.d.ts
DELETED
package/lib/Output.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Output = void 0;
|
4
|
-
const core_1 = require("aws-cdk-lib/core");
|
5
|
-
class Output extends core_1.CfnOutput {
|
6
|
-
constructor(stack, name, value) {
|
7
|
-
super(stack, stack.genId(name, 'output'), {
|
8
|
-
value,
|
9
|
-
exportName: stack.genName(name)
|
10
|
-
});
|
11
|
-
}
|
12
|
-
}
|
13
|
-
exports.Output = Output;
|
package/lib/RestApi.d.ts
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
import { IDomainName, IResource, RestApi as RestApiBase } from "aws-cdk-lib/aws-apigateway";
|
2
|
-
import { DeployStack } from "./DeployStack";
|
3
|
-
import { ICorsConfig } from "./ICorsConfig";
|
4
|
-
import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
5
|
-
interface IRestApiConfig {
|
6
|
-
cors?: ICorsConfig;
|
7
|
-
allowCredentials: boolean;
|
8
|
-
}
|
9
|
-
interface IBasePathMappingConfig {
|
10
|
-
domain?: IDomainName;
|
11
|
-
domainName?: string;
|
12
|
-
hostedZoneId?: string;
|
13
|
-
}
|
14
|
-
interface IResourceNode {
|
15
|
-
children: {
|
16
|
-
[key: string]: IResourceNode;
|
17
|
-
};
|
18
|
-
node: IResource;
|
19
|
-
}
|
20
|
-
export declare class RestApi extends RestApiBase {
|
21
|
-
_id: string;
|
22
|
-
_tree: IResourceNode;
|
23
|
-
constructor(stack: DeployStack, id: string, props: IRestApiConfig);
|
24
|
-
addBasePathMapping(stack: DeployStack, config: IBasePathMappingConfig): void;
|
25
|
-
addAuthorizedRole(stack: DeployStack, roleArn: string): PolicyStatement;
|
26
|
-
path(uri: string): IResource;
|
27
|
-
}
|
28
|
-
export {};
|
package/lib/Role.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Role = void 0;
|
4
|
-
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
5
|
-
const Output_1 = require("./Output");
|
6
|
-
class Role extends aws_iam_1.Role {
|
7
|
-
constructor(stack, id, props) {
|
8
|
-
console.log('Defining Role', stack.genId(id));
|
9
|
-
if (!props.assumedBy) {
|
10
|
-
props.assumedBy = new aws_iam_1.FederatedPrincipal('cognito-identity.amazonaws.com', {
|
11
|
-
StringEquals: {
|
12
|
-
'cognito-identity.amazonaws.com:aud': props.identityPool
|
13
|
-
},
|
14
|
-
"ForAnyValue:StringLike": {
|
15
|
-
'cognito-identity.amazonaws.com:amr': props.amr
|
16
|
-
}
|
17
|
-
}, 'sts:AssumeRoleWithWebIdentity');
|
18
|
-
}
|
19
|
-
super(stack, stack.genId(id), {
|
20
|
-
...props,
|
21
|
-
roleName: stack.genName(props.roleName || id),
|
22
|
-
assumedBy: props.assumedBy
|
23
|
-
});
|
24
|
-
new Output_1.Output(stack, `${id}-arn`, this.roleArn);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
exports.Role = Role;
|
package/lib/SsmParameter.d.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import { DeployStack } from "./DeployStack";
|
2
|
-
import { IStringParameter } from "aws-cdk-lib/aws-ssm";
|
3
|
-
import { IGrantable } from "aws-cdk-lib/aws-iam";
|
4
|
-
import { IKey } from "aws-cdk-lib/aws-kms";
|
5
|
-
export interface SsmParameterOptions {
|
6
|
-
decryptWithKey?: IKey;
|
7
|
-
parameterGroup?: string;
|
8
|
-
}
|
9
|
-
export declare class SsmParameter {
|
10
|
-
parameterName: string;
|
11
|
-
parameterArn: string;
|
12
|
-
decryptWithKey?: IKey;
|
13
|
-
_stack: DeployStack;
|
14
|
-
constructor(stack: DeployStack, name: string, options?: SsmParameterOptions);
|
15
|
-
grantRead(grantee: IGrantable): void;
|
16
|
-
get stringValue(): string;
|
17
|
-
getParameter(): IStringParameter;
|
18
|
-
}
|
package/lib/SsmParameter.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SsmParameter = void 0;
|
4
|
-
const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
|
5
|
-
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
6
|
-
const paramCache = {};
|
7
|
-
class SsmParameter {
|
8
|
-
parameterName;
|
9
|
-
parameterArn;
|
10
|
-
decryptWithKey;
|
11
|
-
_stack;
|
12
|
-
constructor(stack, name, options) {
|
13
|
-
if (name[0] !== '/')
|
14
|
-
name = '/' + name;
|
15
|
-
this.parameterName = `/${options?.parameterGroup ?? stack.name}${name}`;
|
16
|
-
this.parameterArn = `arn:aws:ssm:${stack.region}:${stack.account}:parameter${this.parameterName}`;
|
17
|
-
this._stack = stack;
|
18
|
-
this.decryptWithKey = options?.decryptWithKey;
|
19
|
-
}
|
20
|
-
grantRead(grantee) {
|
21
|
-
grantee.grantPrincipal.addToPrincipalPolicy(new aws_iam_1.PolicyStatement({
|
22
|
-
effect: aws_iam_1.Effect.ALLOW,
|
23
|
-
actions: ['ssm:GetParameter'],
|
24
|
-
resources: [this.parameterArn]
|
25
|
-
}));
|
26
|
-
if (this.decryptWithKey) {
|
27
|
-
this.decryptWithKey.grantDecrypt(grantee);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
get stringValue() {
|
31
|
-
return this.getParameter().stringValue;
|
32
|
-
}
|
33
|
-
getParameter() {
|
34
|
-
if (!paramCache[this.parameterArn]) {
|
35
|
-
paramCache[this.parameterArn] = aws_ssm_1.StringParameter.fromStringParameterName(this._stack, this._stack.genId(this.parameterName.substring(1).replace('/', '_')), this.parameterName);
|
36
|
-
}
|
37
|
-
return paramCache[this.parameterArn];
|
38
|
-
}
|
39
|
-
}
|
40
|
-
exports.SsmParameter = SsmParameter;
|
package/lib/StaticWebSite.d.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { DeployStack } from "./DeployStack";
|
3
|
-
import { SourceConfiguration } from "aws-cdk-lib/aws-cloudfront";
|
4
|
-
import IDomainConfig from "./IDomainConfig";
|
5
|
-
/**
|
6
|
-
* Configuration interface for the StaticWebSite class.
|
7
|
-
*/
|
8
|
-
export interface StaticWebSiteConfig {
|
9
|
-
srcDir?: string;
|
10
|
-
domain: IDomainConfig;
|
11
|
-
env: NodeJS.ProcessEnv;
|
12
|
-
proxy?: SourceConfiguration[];
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* Logic which will setup a static web site in AWS with an S3 Bucket, CloudFront Distribution, and Route53 A-Name Record.
|
16
|
-
*/
|
17
|
-
export declare class StaticWebSite {
|
18
|
-
/**
|
19
|
-
* Constructs a new StaticWebSite instance.
|
20
|
-
* @param {DeployStack} stack - The deployment stack.
|
21
|
-
* @param {string} id - The ID of the website.
|
22
|
-
* @param {StaticWebSiteConfig} props - The configuration properties of the website.
|
23
|
-
*/
|
24
|
-
constructor(stack: DeployStack, id: string, props: StaticWebSiteConfig);
|
25
|
-
/**
|
26
|
-
* Defines a proxy for the static website.
|
27
|
-
* @param {DeployStack} stack - The deployment stack.
|
28
|
-
* @param {string} domainName - The domain name.
|
29
|
-
* @param {string} pathPattern - The path pattern.
|
30
|
-
* @returns {SourceConfiguration} The source configuration for the proxy.
|
31
|
-
*/
|
32
|
-
static defineProxy(stack: DeployStack, domainName: string, pathPattern: string): SourceConfiguration;
|
33
|
-
}
|
package/lib/StaticWebSite.js
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.StaticWebSite = void 0;
|
7
|
-
const core_1 = require("aws-cdk-lib/core");
|
8
|
-
const Output_1 = require("./Output");
|
9
|
-
const child_process_1 = require("child_process");
|
10
|
-
const aws_s3_1 = require("aws-cdk-lib/aws-s3");
|
11
|
-
const aws_s3_deployment_1 = require("aws-cdk-lib/aws-s3-deployment");
|
12
|
-
const ApiCertificate_1 = __importDefault(require("./ApiCertificate"));
|
13
|
-
const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront");
|
14
|
-
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
15
|
-
const aws_route53_1 = require("aws-cdk-lib/aws-route53");
|
16
|
-
const aws_route53_targets_1 = require("aws-cdk-lib/aws-route53-targets");
|
17
|
-
const duration_1 = __importDefault(require("./methods/duration"));
|
18
|
-
const build_node_source_1 = require("./methods/build-node-source");
|
19
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
20
|
-
/**
|
21
|
-
* Logic which will setup a static web site in AWS with an S3 Bucket, CloudFront Distribution, and Route53 A-Name Record.
|
22
|
-
*/
|
23
|
-
class StaticWebSite {
|
24
|
-
/**
|
25
|
-
* Constructs a new StaticWebSite instance.
|
26
|
-
* @param {DeployStack} stack - The deployment stack.
|
27
|
-
* @param {string} id - The ID of the website.
|
28
|
-
* @param {StaticWebSiteConfig} props - The configuration properties of the website.
|
29
|
-
*/
|
30
|
-
constructor(stack, id, props) {
|
31
|
-
console.log('Deploying Static Web Site', id);
|
32
|
-
const done = (0, duration_1.default)();
|
33
|
-
const buildDir = (0, build_node_source_1.buildNodeSource)('web', id);
|
34
|
-
console.log('Building UI Source', id);
|
35
|
-
(0, child_process_1.execSync)('npm run export', {
|
36
|
-
cwd: buildDir,
|
37
|
-
env: props.env
|
38
|
-
});
|
39
|
-
console.log('Total Build Duration (ms)', done());
|
40
|
-
const exportDir = buildDir + '/out';
|
41
|
-
console.log('Creating HTTPS Certificate', id + '-certificate');
|
42
|
-
const certificate = new ApiCertificate_1.default(stack, id + '-certificate', props.domain);
|
43
|
-
console.log('Deploying Site Content Bucket', stack.genId(id, "content-bucket"));
|
44
|
-
const s3BucketSource = new aws_s3_1.Bucket(stack, stack.genId(id, "content-bucket"), {
|
45
|
-
bucketName: certificate.domain,
|
46
|
-
websiteIndexDocument: "index.html",
|
47
|
-
websiteErrorDocument: "error.html",
|
48
|
-
removalPolicy: core_1.RemovalPolicy.DESTROY,
|
49
|
-
autoDeleteObjects: true,
|
50
|
-
publicReadAccess: false,
|
51
|
-
blockPublicAccess: {
|
52
|
-
blockPublicAcls: true,
|
53
|
-
blockPublicPolicy: true,
|
54
|
-
ignorePublicAcls: true,
|
55
|
-
restrictPublicBuckets: true
|
56
|
-
}
|
57
|
-
});
|
58
|
-
new Output_1.Output(stack, `${id}-content-bucket`, s3BucketSource.bucketName);
|
59
|
-
const cloudFrontPolicy = new aws_iam_1.PolicyStatement({
|
60
|
-
actions: ['s3:GetBucket*', 's3:GetObject*', 's3:List*'],
|
61
|
-
resources: [s3BucketSource.bucketArn, s3BucketSource.bucketArn + '/*'],
|
62
|
-
});
|
63
|
-
new aws_s3_deployment_1.BucketDeployment(stack, stack.genId(id, 'bucket-deployment'), {
|
64
|
-
sources: [aws_s3_deployment_1.Source.asset(exportDir)],
|
65
|
-
destinationBucket: s3BucketSource
|
66
|
-
});
|
67
|
-
const originAccessIdentity = new aws_cloudfront_1.OriginAccessIdentity(stack, "WebsiteOAI");
|
68
|
-
cloudFrontPolicy.addArnPrincipal(originAccessIdentity.cloudFrontOriginAccessIdentityS3CanonicalUserId);
|
69
|
-
s3BucketSource.grantRead(originAccessIdentity);
|
70
|
-
const distro = new aws_cloudfront_1.CloudFrontWebDistribution(stack, stack.genId(id, 'cloudfront-web-distribution'), {
|
71
|
-
enabled: true,
|
72
|
-
originConfigs: [...props.proxy || [], {
|
73
|
-
s3OriginSource: {
|
74
|
-
s3BucketSource,
|
75
|
-
originAccessIdentity
|
76
|
-
},
|
77
|
-
behaviors: [{
|
78
|
-
allowedMethods: aws_cloudfront_1.CloudFrontAllowedMethods.GET_HEAD_OPTIONS,
|
79
|
-
isDefaultBehavior: true
|
80
|
-
}]
|
81
|
-
}],
|
82
|
-
viewerProtocolPolicy: aws_cloudfront_1.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
83
|
-
viewerCertificate: aws_cloudfront_1.ViewerCertificate.fromAcmCertificate(certificate, {
|
84
|
-
aliases: [certificate.domain],
|
85
|
-
sslMethod: aws_cloudfront_1.SSLMethod.SNI
|
86
|
-
})
|
87
|
-
});
|
88
|
-
new Output_1.Output(stack, `${id}-base-url`, "https://" + certificate.domain);
|
89
|
-
console.log('Setting Route53 A-Name Record', props.domain.domainName);
|
90
|
-
new aws_route53_1.ARecord(stack, stack.genId('alias'), {
|
91
|
-
zone: certificate.hostedZone,
|
92
|
-
recordName: certificate.domain,
|
93
|
-
target: aws_route53_1.RecordTarget.fromAlias(new aws_route53_targets_1.CloudFrontTarget(distro))
|
94
|
-
});
|
95
|
-
}
|
96
|
-
/**
|
97
|
-
* Defines a proxy for the static website.
|
98
|
-
* @param {DeployStack} stack - The deployment stack.
|
99
|
-
* @param {string} domainName - The domain name.
|
100
|
-
* @param {string} pathPattern - The path pattern.
|
101
|
-
* @returns {SourceConfiguration} The source configuration for the proxy.
|
102
|
-
*/
|
103
|
-
static defineProxy(stack, domainName, pathPattern) {
|
104
|
-
return {
|
105
|
-
customOriginSource: {
|
106
|
-
domainName: domainName,
|
107
|
-
originPath: `/${stack.stage}`,
|
108
|
-
originProtocolPolicy: aws_cloudfront_1.OriginProtocolPolicy.HTTPS_ONLY
|
109
|
-
},
|
110
|
-
behaviors: [{
|
111
|
-
pathPattern,
|
112
|
-
allowedMethods: aws_cloudfront_1.CloudFrontAllowedMethods.ALL,
|
113
|
-
maxTtl: aws_cdk_lib_1.Duration.seconds(0),
|
114
|
-
minTtl: aws_cdk_lib_1.Duration.seconds(0),
|
115
|
-
defaultTtl: aws_cdk_lib_1.Duration.seconds(0),
|
116
|
-
compress: false,
|
117
|
-
forwardedValues: {
|
118
|
-
queryString: true,
|
119
|
-
headers: [
|
120
|
-
"Authorization",
|
121
|
-
"User-Agent",
|
122
|
-
"X-Trace-Id",
|
123
|
-
"X-Span-Id",
|
124
|
-
"X-Correlation-Id",
|
125
|
-
'Referer',
|
126
|
-
"User-Agent",
|
127
|
-
"Accept-Language",
|
128
|
-
'Content-Type',
|
129
|
-
'Content-Length'
|
130
|
-
]
|
131
|
-
}
|
132
|
-
}]
|
133
|
-
};
|
134
|
-
}
|
135
|
-
}
|
136
|
-
exports.StaticWebSite = StaticWebSite;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.applyHoneycombToLambda = void 0;
|
4
|
-
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
5
|
-
const SsmParameter_1 = require("../SsmParameter");
|
6
|
-
let honeyCombLayer;
|
7
|
-
function applyHoneycombToLambda(stack, props) {
|
8
|
-
if (!honeyCombLayer)
|
9
|
-
honeyCombLayer = aws_lambda_1.LayerVersion.fromLayerVersionArn(stack, stack.genId('hc-layer'), `arn:aws:lambda:${stack.region}:702835727665:layer:honeycomb-lambda-extension-x86_64-v11-1-1:1`);
|
10
|
-
const layers = props.layers ? [...props.layers] : [];
|
11
|
-
const environment = { ...props.environment };
|
12
|
-
const options = { parameterGroup: stack.project };
|
13
|
-
layers.push(honeyCombLayer);
|
14
|
-
environment.LIBHONEY_API_KEY = new SsmParameter_1.SsmParameter(stack, `/honeycomb/api-key`, options).stringValue;
|
15
|
-
environment.LIBHONEY_DATASET = new SsmParameter_1.SsmParameter(stack, `/honeycomb/dataset`, options).stringValue;
|
16
|
-
environment.LOGS_API_DISABLE_PLATFORM_MSGS = "true";
|
17
|
-
return {
|
18
|
-
...props,
|
19
|
-
layers,
|
20
|
-
environment
|
21
|
-
};
|
22
|
-
}
|
23
|
-
exports.applyHoneycombToLambda = applyHoneycombToLambda;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|