quidproquo-deploy-awscdk 0.0.199 → 0.0.201
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/lib/esm/QPQApp.d.ts +2 -0
- package/lib/esm/QPQApp.js +4 -0
- package/lib/esm/constants/BootstrapResource.d.ts +3 -0
- package/lib/esm/constants/BootstrapResource.js +4 -0
- package/lib/esm/constants/index.d.ts +3 -0
- package/lib/esm/constants/index.js +3 -0
- package/lib/esm/constants/logging.d.ts +1 -0
- package/lib/esm/constants/logging.js +1 -0
- package/lib/esm/constants/warmLambdas.d.ts +2 -0
- package/lib/esm/constants/warmLambdas.js +1 -0
- package/lib/esm/constructs/base/QpqConstructBlock.d.ts +23 -0
- package/lib/esm/constructs/base/QpqConstructBlock.js +39 -0
- package/lib/esm/constructs/base/QpqResource.d.ts +21 -0
- package/lib/esm/constructs/base/QpqResource.js +1 -0
- package/lib/esm/constructs/base/index.d.ts +2 -0
- package/lib/esm/constructs/base/index.js +2 -0
- package/lib/esm/constructs/basic/BSQpqLambdaWarmerEventConstruct.d.ts +7 -0
- package/lib/esm/constructs/basic/BSQpqLambdaWarmerEventConstruct.js +22 -0
- package/lib/esm/constructs/basic/DnsValidatedCertificate.d.ts +18 -0
- package/lib/esm/constructs/basic/DnsValidatedCertificate.js +35 -0
- package/lib/esm/constructs/basic/Function.d.ts +23 -0
- package/lib/esm/constructs/basic/Function.js +40 -0
- package/lib/esm/constructs/basic/InfQpqWebserverServiceDomainsConstruct.d.ts +7 -0
- package/lib/esm/constructs/basic/InfQpqWebserverServiceDomainsConstruct.js +30 -0
- package/lib/esm/constructs/basic/LambdaLayers.d.ts +9 -0
- package/lib/esm/constructs/basic/LambdaLayers.js +20 -0
- package/lib/esm/constructs/basic/LogStorage.d.ts +22 -0
- package/lib/esm/constructs/basic/LogStorage.js +86 -0
- package/lib/esm/constructs/basic/ServiceDomain.d.ts +8 -0
- package/lib/esm/constructs/basic/ServiceDomain.js +39 -0
- package/lib/esm/constructs/basic/SubdomainName.d.ts +14 -0
- package/lib/esm/constructs/basic/SubdomainName.js +37 -0
- package/lib/esm/constructs/basic/WebserverRoll.d.ts +9 -0
- package/lib/esm/constructs/basic/WebserverRoll.js +83 -0
- package/lib/esm/constructs/basic/index.d.ts +6 -0
- package/lib/esm/constructs/basic/index.js +6 -0
- package/lib/esm/constructs/feature/config/alarm/QpqConfigAwsAlarm.d.ts +9 -0
- package/lib/esm/constructs/feature/config/alarm/QpqConfigAwsAlarm.js +50 -0
- package/lib/esm/constructs/feature/config/alarm/index.d.ts +1 -0
- package/lib/esm/constructs/feature/config/alarm/index.js +1 -0
- package/lib/esm/constructs/feature/config/index.d.ts +1 -0
- package/lib/esm/constructs/feature/config/index.js +1 -0
- package/lib/esm/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.d.ts +20 -0
- package/lib/esm/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.js +112 -0
- package/lib/esm/constructs/feature/core/auth/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/auth/index.js +1 -0
- package/lib/esm/constructs/feature/core/deployEvents/QpqCoreDeployEventConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/core/deployEvents/QpqCoreDeployEventConstruct.js +33 -0
- package/lib/esm/constructs/feature/core/deployEvents/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/deployEvents/index.js +1 -0
- package/lib/esm/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.d.ts +18 -0
- package/lib/esm/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.js +56 -0
- package/lib/esm/constructs/feature/core/eventBus/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/eventBus/index.js +1 -0
- package/lib/esm/constructs/feature/core/index.d.ts +9 -0
- package/lib/esm/constructs/feature/core/index.js +9 -0
- package/lib/esm/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.d.ts +21 -0
- package/lib/esm/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.js +95 -0
- package/lib/esm/constructs/feature/core/keyValueStore/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/keyValueStore/index.js +1 -0
- package/lib/esm/constructs/feature/core/parameter/QpqCoreParameterConstruct.d.ts +20 -0
- package/lib/esm/constructs/feature/core/parameter/QpqCoreParameterConstruct.js +51 -0
- package/lib/esm/constructs/feature/core/parameter/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/parameter/index.js +1 -0
- package/lib/esm/constructs/feature/core/queue/QpqApiCoreQueueConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/core/queue/QpqApiCoreQueueConstruct.js +60 -0
- package/lib/esm/constructs/feature/core/queue/QpqCoreQueueConstruct.d.ts +19 -0
- package/lib/esm/constructs/feature/core/queue/QpqCoreQueueConstruct.js +80 -0
- package/lib/esm/constructs/feature/core/queue/index.d.ts +2 -0
- package/lib/esm/constructs/feature/core/queue/index.js +2 -0
- package/lib/esm/constructs/feature/core/schedule/QpqCoreRecurringScheduleConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/core/schedule/QpqCoreRecurringScheduleConstruct.js +33 -0
- package/lib/esm/constructs/feature/core/schedule/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/schedule/index.js +1 -0
- package/lib/esm/constructs/feature/core/secret/QpqCoreSecretConstruct.d.ts +20 -0
- package/lib/esm/constructs/feature/core/secret/QpqCoreSecretConstruct.js +50 -0
- package/lib/esm/constructs/feature/core/secret/index.d.ts +1 -0
- package/lib/esm/constructs/feature/core/secret/index.js +1 -0
- package/lib/esm/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.js +49 -0
- package/lib/esm/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.d.ts +20 -0
- package/lib/esm/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.js +110 -0
- package/lib/esm/constructs/feature/core/storageDrive/index.d.ts +2 -0
- package/lib/esm/constructs/feature/core/storageDrive/index.js +2 -0
- package/lib/esm/constructs/feature/index.d.ts +3 -0
- package/lib/esm/constructs/feature/index.js +3 -0
- package/lib/esm/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.js +38 -0
- package/lib/esm/constructs/feature/webserver/api/BootstrapQpqWebserverApiConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/api/BootstrapQpqWebserverApiConstruct.js +17 -0
- package/lib/esm/constructs/feature/webserver/api/index.d.ts +2 -0
- package/lib/esm/constructs/feature/webserver/api/index.js +2 -0
- package/lib/esm/constructs/feature/webserver/apiKey/QpqWebserverApiKeyConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/apiKey/QpqWebserverApiKeyConstruct.js +17 -0
- package/lib/esm/constructs/feature/webserver/apiKey/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/apiKey/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/cache/QpqWebServerCacheConstruct.d.ts +13 -0
- package/lib/esm/constructs/feature/webserver/cache/QpqWebServerCacheConstruct.js +29 -0
- package/lib/esm/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.js +16 -0
- package/lib/esm/constructs/feature/webserver/certificate/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/certificate/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.js +42 -0
- package/lib/esm/constructs/feature/webserver/domain/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/domain/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.js +67 -0
- package/lib/esm/constructs/feature/webserver/domainProxy/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/domainProxy/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/index.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/index.js +9 -0
- package/lib/esm/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.js +53 -0
- package/lib/esm/constructs/feature/webserver/redirect/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/redirect/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/serviceFunction/QpqWebserverServiceFunctionConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/serviceFunction/QpqWebserverServiceFunctionConstruct.js +20 -0
- package/lib/esm/constructs/feature/webserver/serviceFunction/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/serviceFunction/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.js +196 -0
- package/lib/esm/constructs/feature/webserver/webEntry/index.d.ts +1 -0
- package/lib/esm/constructs/feature/webserver/webEntry/index.js +1 -0
- package/lib/esm/constructs/feature/webserver/webEntry/utils/securityHeaders.d.ts +10 -0
- package/lib/esm/constructs/feature/webserver/webEntry/utils/securityHeaders.js +136 -0
- package/lib/esm/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.d.ts +11 -0
- package/lib/esm/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.js +96 -0
- package/lib/esm/constructs/feature/webserver/websocket/QpqWebserverWebsocketConstruct.d.ts +9 -0
- package/lib/esm/constructs/feature/webserver/websocket/QpqWebserverWebsocketConstruct.js +15 -0
- package/lib/esm/constructs/feature/webserver/websocket/index.d.ts +2 -0
- package/lib/esm/constructs/feature/webserver/websocket/index.js +2 -0
- package/lib/esm/constructs/index.d.ts +3 -0
- package/lib/esm/constructs/index.js +3 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/lambdas/actionProcessorListResolver.d.ts +2 -0
- package/lib/esm/lambdas/actionProcessorListResolver.js +1 -0
- package/lib/esm/lambdas/dynamicModuleLoader/dynamicModuleLoader.d.ts +1 -0
- package/lib/esm/lambdas/dynamicModuleLoader/dynamicModuleLoader.js +13 -0
- package/lib/esm/lambdas/dynamicModuleLoader/dynamicModuleLoaderWarmer.d.ts +1 -0
- package/lib/esm/lambdas/dynamicModuleLoader/dynamicModuleLoaderWarmer.js +6 -0
- package/lib/esm/lambdas/dynamicModuleLoader/index.d.ts +2 -0
- package/lib/esm/lambdas/dynamicModuleLoader/index.js +2 -0
- package/lib/esm/lambdas/index.d.ts +4 -0
- package/lib/esm/lambdas/index.js +4 -0
- package/lib/esm/lambdas/lambda-utils/getLambdaActionProcessors.d.ts +2 -0
- package/lib/esm/lambdas/lambda-utils/getLambdaActionProcessors.js +30 -0
- package/lib/esm/lambdas/lambda-utils/getQpqLambdaRuntimeForEvent.d.ts +3 -0
- package/lib/esm/lambdas/lambda-utils/getQpqLambdaRuntimeForEvent.js +56 -0
- package/lib/esm/lambdas/lambda-utils/getRuntimeCorrelation.d.ts +2 -0
- package/lib/esm/lambdas/lambda-utils/getRuntimeCorrelation.js +6 -0
- package/lib/esm/lambdas/lambda-utils/index.d.ts +5 -0
- package/lib/esm/lambdas/lambda-utils/index.js +5 -0
- package/lib/esm/lambdas/lambda-utils/logger.d.ts +5 -0
- package/lib/esm/lambdas/lambda-utils/logger.js +94 -0
- package/lib/esm/lambdas/lambda-utils/qpqFunctionMiddleware.d.ts +3 -0
- package/lib/esm/lambdas/lambda-utils/qpqFunctionMiddleware.js +39 -0
- package/lib/esm/lambdas/lambdaAPIGatewayEvent.d.ts +1 -0
- package/lib/esm/lambdas/lambdaAPIGatewayEvent.js +13 -0
- package/lib/esm/lambdas/lambdaAPIGatewayEvent_redirect.d.ts +15 -0
- package/lib/esm/lambdas/lambdaAPIGatewayEvent_redirect.js +37 -0
- package/lib/esm/lambdas/lambdaCognitoTriggerEvent_CustomMessage.d.ts +2 -0
- package/lib/esm/lambdas/lambdaCognitoTriggerEvent_CustomMessage.js +10 -0
- package/lib/esm/lambdas/lambdaConfig.d.ts +5 -0
- package/lib/esm/lambdas/lambdaConfig.js +7 -0
- package/lib/esm/lambdas/lambdaEventBridgeEvent.d.ts +2 -0
- package/lib/esm/lambdas/lambdaEventBridgeEvent.js +9 -0
- package/lib/esm/lambdas/lambdaEventBridgeEventStackDeploy.d.ts +2 -0
- package/lib/esm/lambdas/lambdaEventBridgeEventStackDeploy.js +9 -0
- package/lib/esm/lambdas/lambdaEventOriginRequest.d.ts +2 -0
- package/lib/esm/lambdas/lambdaEventOriginRequest.js +10 -0
- package/lib/esm/lambdas/lambdaEventViewerRequest.d.ts +39 -0
- package/lib/esm/lambdas/lambdaEventViewerRequest.js +25 -0
- package/lib/esm/lambdas/lambdaS3FileEvent.d.ts +2 -0
- package/lib/esm/lambdas/lambdaS3FileEvent.js +10 -0
- package/lib/esm/lambdas/lambdaSQSEvent.d.ts +2 -0
- package/lib/esm/lambdas/lambdaSQSEvent.js +10 -0
- package/lib/esm/lambdas/lambdaServiceFunctionExecute.d.ts +7 -0
- package/lib/esm/lambdas/lambdaServiceFunctionExecute.js +7 -0
- package/lib/esm/lambdas/lambdaWebsocketAPIGatewayEvent.d.ts +9 -0
- package/lib/esm/lambdas/lambdaWebsocketAPIGatewayEvent.js +10 -0
- package/lib/esm/stacks/ApiQpqServiceStack.d.ts +9 -0
- package/lib/esm/stacks/ApiQpqServiceStack.js +78 -0
- package/lib/esm/stacks/BootstrapQpqServiceStack.d.ts +7 -0
- package/lib/esm/stacks/BootstrapQpqServiceStack.js +19 -0
- package/lib/esm/stacks/InfQpqServiceStack.d.ts +7 -0
- package/lib/esm/stacks/InfQpqServiceStack.js +98 -0
- package/lib/esm/stacks/WebQpqServiceStack.d.ts +9 -0
- package/lib/esm/stacks/WebQpqServiceStack.js +24 -0
- package/lib/esm/stacks/base/QpqServiceStack.d.ts +13 -0
- package/lib/esm/stacks/base/QpqServiceStack.js +20 -0
- package/lib/esm/stacks/index.d.ts +4 -0
- package/lib/esm/stacks/index.js +4 -0
- package/lib/esm/types/QpqWarmLambdaEvent.d.ts +5 -0
- package/lib/esm/types/QpqWarmLambdaEvent.js +1 -0
- package/lib/esm/types/index.d.ts +1 -0
- package/lib/esm/types/index.js +1 -0
- package/lib/esm/utils/index.d.ts +2 -0
- package/lib/esm/utils/index.js +2 -0
- package/lib/esm/utils/qpqAwsCdkNamingUtils.d.ts +5 -0
- package/lib/esm/utils/qpqAwsCdkNamingUtils.js +6 -0
- package/lib/esm/utils/qpqDeployAwsCdkUtils.d.ts +18 -0
- package/lib/esm/utils/qpqDeployAwsCdkUtils.js +108 -0
- package/package.json +14 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const QPQ_LOG_BUCKET_NAME = "logs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const QPQ_LOG_BUCKET_NAME = 'logs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const WARM_LAMBDA_EVENT = { qpqWarm: true };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { QpqResource } from './QpqResource';
|
|
4
|
+
import { IGrantable } from 'aws-cdk-lib/aws-iam';
|
|
5
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
6
|
+
export interface QpqConstructBlockProps {
|
|
7
|
+
awsAccountId: string;
|
|
8
|
+
qpqConfig: QPQConfig;
|
|
9
|
+
}
|
|
10
|
+
export declare class QpqConstructBlock extends Construct implements QpqResource {
|
|
11
|
+
awsAccountId: string;
|
|
12
|
+
qpqConfig: QPQConfig;
|
|
13
|
+
serviceRole?: aws_iam.IRole;
|
|
14
|
+
constructor(scope: Construct, id: string, props: QpqConstructBlockProps);
|
|
15
|
+
resourceName(name: string): string;
|
|
16
|
+
resourceNameWithModuleOveride(name: string, module?: string): string;
|
|
17
|
+
qpqResourceName(name: string, resourceType: string): string;
|
|
18
|
+
qpqBootstrapResourceName(name: string): string;
|
|
19
|
+
grantRead(grantee: IGrantable): void;
|
|
20
|
+
grantWrite(grantee: IGrantable): void;
|
|
21
|
+
grantAll(grantee: IGrantable): void;
|
|
22
|
+
getServiceRole(): aws_iam.IRole;
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { awsNamingUtils } from 'quidproquo-actionprocessor-awslambda';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
4
|
+
export class QpqConstructBlock extends Construct {
|
|
5
|
+
awsAccountId;
|
|
6
|
+
qpqConfig;
|
|
7
|
+
serviceRole;
|
|
8
|
+
constructor(scope, id, props) {
|
|
9
|
+
super(scope, id);
|
|
10
|
+
this.awsAccountId = props.awsAccountId;
|
|
11
|
+
this.qpqConfig = props.qpqConfig;
|
|
12
|
+
}
|
|
13
|
+
resourceName(name) {
|
|
14
|
+
return awsNamingUtils.getConfigRuntimeResourceNameFromConfig(name, this.qpqConfig);
|
|
15
|
+
}
|
|
16
|
+
resourceNameWithModuleOveride(name, module) {
|
|
17
|
+
return awsNamingUtils.getConfigRuntimeResourceNameFromConfigWithServiceOverride(name, this.qpqConfig, module);
|
|
18
|
+
}
|
|
19
|
+
qpqResourceName(name, resourceType) {
|
|
20
|
+
return awsNamingUtils.getQpqRuntimeResourceNameFromConfig(name, this.qpqConfig, resourceType);
|
|
21
|
+
}
|
|
22
|
+
qpqBootstrapResourceName(name) {
|
|
23
|
+
return awsNamingUtils.getConfigRuntimeBootstrapResourceNameFromConfig(name, this.qpqConfig);
|
|
24
|
+
}
|
|
25
|
+
grantRead(grantee) { }
|
|
26
|
+
grantWrite(grantee) { }
|
|
27
|
+
grantAll(grantee) {
|
|
28
|
+
this.grantRead(grantee);
|
|
29
|
+
this.grantWrite(grantee);
|
|
30
|
+
}
|
|
31
|
+
getServiceRole() {
|
|
32
|
+
if (!this.serviceRole) {
|
|
33
|
+
this.serviceRole = aws_iam.Role.fromRoleName(this, 'service-role', this.resourceName('service-role'), {
|
|
34
|
+
mutable: true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return this.serviceRole;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
2
|
+
export interface QpqResource {
|
|
3
|
+
/**
|
|
4
|
+
* Grants read permissions on this resource.
|
|
5
|
+
*
|
|
6
|
+
* @param grantee the role to be granted read-only access to the resource.
|
|
7
|
+
*/
|
|
8
|
+
grantRead(grantee: aws_iam.IGrantable): void;
|
|
9
|
+
/**
|
|
10
|
+
* Grants write permissions on the resource.
|
|
11
|
+
*
|
|
12
|
+
* @param grantee the role to be granted write access to the resource.
|
|
13
|
+
*/
|
|
14
|
+
grantWrite(grantee: aws_iam.IGrantable): void;
|
|
15
|
+
/**
|
|
16
|
+
* Grants read/write permissions on the resource.
|
|
17
|
+
*
|
|
18
|
+
* @param grantee the role to be granted read/write access to the resource.
|
|
19
|
+
*/
|
|
20
|
+
grantAll(grantee: aws_iam.IGrantable): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
export interface BSQpqLambdaWarmerEventConstructConstructProps extends QpqConstructBlockProps {
|
|
4
|
+
}
|
|
5
|
+
export declare class BSQpqLambdaWarmerEventConstructConstruct extends QpqConstructBlock {
|
|
6
|
+
constructor(scope: Construct, id: string, props: BSQpqLambdaWarmerEventConstructConstructProps);
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { aws_events, aws_sns, aws_events_targets } from 'aws-cdk-lib';
|
|
2
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
3
|
+
import { BootstrapResource } from '../../constants';
|
|
4
|
+
export class BSQpqLambdaWarmerEventConstructConstruct extends QpqConstructBlock {
|
|
5
|
+
constructor(scope, id, props) {
|
|
6
|
+
super(scope, id, props);
|
|
7
|
+
const rule = new aws_events.Rule(this, 'WarmLambdaRule', {
|
|
8
|
+
ruleName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
9
|
+
// Create an EventBridge rule to trigger the Lambda every X minutes
|
|
10
|
+
schedule: aws_events.Schedule.expression('rate(5 minutes)'),
|
|
11
|
+
});
|
|
12
|
+
const topic = new aws_sns.Topic(this, 'MyTopic', {
|
|
13
|
+
topicName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
14
|
+
displayName: 'Warm Lambdas',
|
|
15
|
+
});
|
|
16
|
+
rule.addTarget(new aws_events_targets.SnsTopic(topic, {
|
|
17
|
+
message: aws_events.RuleTargetInput.fromObject({
|
|
18
|
+
type: 'QpqLambdaWarmerEvent',
|
|
19
|
+
}),
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_route53, aws_certificatemanager } from 'aws-cdk-lib';
|
|
4
|
+
interface DomainConfig {
|
|
5
|
+
rootDomain: string;
|
|
6
|
+
subDomainNames?: string[];
|
|
7
|
+
onRootDomain: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DnsValidatedCertificateProps extends QpqConstructBlockProps {
|
|
10
|
+
domain: DomainConfig;
|
|
11
|
+
}
|
|
12
|
+
export declare class DnsValidatedCertificate extends QpqConstructBlock {
|
|
13
|
+
readonly domainNames: string[];
|
|
14
|
+
readonly certificate: aws_certificatemanager.Certificate;
|
|
15
|
+
readonly hostedZone: aws_route53.IHostedZone;
|
|
16
|
+
constructor(scope: Construct, id: string, props: DnsValidatedCertificateProps);
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
2
|
+
import { aws_route53, aws_certificatemanager } from 'aws-cdk-lib';
|
|
3
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
4
|
+
import * as qpqDeployAwsCdkUtils from '../../utils';
|
|
5
|
+
export class DnsValidatedCertificate extends QpqConstructBlock {
|
|
6
|
+
domainNames;
|
|
7
|
+
certificate;
|
|
8
|
+
hostedZone;
|
|
9
|
+
constructor(scope, id, props) {
|
|
10
|
+
super(scope, id, props);
|
|
11
|
+
// Determine the apex domain
|
|
12
|
+
const apexDomain = qpqWebServerUtils.resolveApexDomainNameFromDomainConfig(props.qpqConfig, props.domain.rootDomain, props.domain.onRootDomain);
|
|
13
|
+
// Lookup the hosted zone
|
|
14
|
+
this.hostedZone = aws_route53.HostedZone.fromLookup(this, 'MyHostedZone', {
|
|
15
|
+
domainName: apexDomain,
|
|
16
|
+
});
|
|
17
|
+
// Generate domain names for all subdomains
|
|
18
|
+
this.domainNames =
|
|
19
|
+
props.domain.subDomainNames?.map((subDomain) => `${subDomain}.${apexDomain}`) || [];
|
|
20
|
+
// Include the apex domain if onRootDomain is true
|
|
21
|
+
if (props.domain.onRootDomain &&
|
|
22
|
+
(!props.domain.subDomainNames || props.domain.subDomainNames.length === 0)) {
|
|
23
|
+
this.domainNames.unshift(apexDomain);
|
|
24
|
+
}
|
|
25
|
+
// Create the certificate
|
|
26
|
+
this.certificate = new aws_certificatemanager.Certificate(this, 'SiteCertificate', {
|
|
27
|
+
// Use the apex domain or the first subdomain as the main domain name
|
|
28
|
+
domainName: this.domainNames[0],
|
|
29
|
+
// Include all other domain names as subject alternative names (SANs), if any
|
|
30
|
+
subjectAlternativeNames: this.domainNames.slice(1),
|
|
31
|
+
validation: aws_certificatemanager.CertificateValidation.fromDns(this.hostedZone),
|
|
32
|
+
});
|
|
33
|
+
qpqDeployAwsCdkUtils.applyEnvironmentTags(this.certificate, props.qpqConfig);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_lambda, aws_iam } from 'aws-cdk-lib';
|
|
4
|
+
export interface FunctionProps extends QpqConstructBlockProps {
|
|
5
|
+
functionName?: string;
|
|
6
|
+
buildPath: string;
|
|
7
|
+
srcFilename?: string;
|
|
8
|
+
functionType: string;
|
|
9
|
+
executorName: string;
|
|
10
|
+
timeoutInSeconds?: number;
|
|
11
|
+
memoryInBytes?: number;
|
|
12
|
+
environment?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
apiLayerVersions?: aws_lambda.ILayerVersion[];
|
|
16
|
+
reservedConcurrentExecutions?: number;
|
|
17
|
+
role?: aws_iam.IRole;
|
|
18
|
+
reacreateOnFunctionNameChange?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class Function extends QpqConstructBlock {
|
|
21
|
+
readonly lambdaFunction: aws_lambda.Function;
|
|
22
|
+
constructor(scope: Construct, id: string, props: FunctionProps);
|
|
23
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
3
|
+
import { aws_lambda, aws_logs, aws_sns, aws_sns_subscriptions, } from 'aws-cdk-lib';
|
|
4
|
+
import * as cdk from 'aws-cdk-lib';
|
|
5
|
+
import { getAwsServiceAccountInfoConfig } from 'quidproquo-config-aws';
|
|
6
|
+
import { BootstrapResource } from '../../constants';
|
|
7
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
8
|
+
export class Function extends QpqConstructBlock {
|
|
9
|
+
lambdaFunction;
|
|
10
|
+
constructor(scope, id, props) {
|
|
11
|
+
super(scope, id, props);
|
|
12
|
+
const handlerFile = props.srcFilename || 'index';
|
|
13
|
+
const serviceInfo = getAwsServiceAccountInfoConfig(props.qpqConfig);
|
|
14
|
+
const functionId = props.reacreateOnFunctionNameChange && props.functionName ? props.functionName : 'function';
|
|
15
|
+
this.lambdaFunction = new aws_lambda.Function(this, functionId, {
|
|
16
|
+
functionName: props.functionName,
|
|
17
|
+
timeout: cdk.Duration.seconds(props.timeoutInSeconds || 25),
|
|
18
|
+
runtime: aws_lambda.Runtime.NODEJS_18_X,
|
|
19
|
+
memorySize: props.memoryInBytes || serviceInfo.lambdaMaxMemoryInMiB || 1024,
|
|
20
|
+
layers: props.apiLayerVersions,
|
|
21
|
+
code: aws_lambda.Code.fromAsset(path.join(props.buildPath, props.functionType)),
|
|
22
|
+
handler: `${handlerFile}.${props.executorName}`,
|
|
23
|
+
environment: {
|
|
24
|
+
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
|
|
25
|
+
...(props.environment || {}),
|
|
26
|
+
},
|
|
27
|
+
reservedConcurrentExecutions: props.reservedConcurrentExecutions,
|
|
28
|
+
// TODO: Make this optional
|
|
29
|
+
tracing: aws_lambda.Tracing.DISABLED,
|
|
30
|
+
logRetention: aws_logs.RetentionDays.ONE_WEEK,
|
|
31
|
+
role: props.role,
|
|
32
|
+
});
|
|
33
|
+
const region = qpqCoreUtils.getApplicationModuleDeployRegion(props.qpqConfig);
|
|
34
|
+
const accountId = props.awsAccountId;
|
|
35
|
+
const topicName = this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas);
|
|
36
|
+
const topicArn = `arn:aws:sns:${region}:${accountId}:${topicName}`;
|
|
37
|
+
const topic = aws_sns.Topic.fromTopicArn(this, 'ImportedTopic', topicArn);
|
|
38
|
+
topic.addSubscription(new aws_sns_subscriptions.LambdaSubscription(this.lambdaFunction));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
export interface InfQpqWebserverServiceDomainsConstructProps extends QpqConstructBlockProps {
|
|
4
|
+
}
|
|
5
|
+
export declare class InfQpqWebserverServiceDomainsConstruct extends QpqConstructBlock {
|
|
6
|
+
constructor(scope: Construct, id: string, props: InfQpqWebserverServiceDomainsConstructProps);
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
2
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
3
|
+
import { ServiceDomainConstruct } from './ServiceDomain';
|
|
4
|
+
export class InfQpqWebserverServiceDomainsConstruct extends QpqConstructBlock {
|
|
5
|
+
constructor(scope, id, props) {
|
|
6
|
+
super(scope, id, props);
|
|
7
|
+
const webEntryRootDomains = qpqWebServerUtils
|
|
8
|
+
.getWebEntryConfigs(props.qpqConfig)
|
|
9
|
+
.filter((we) => !we.domain.onRootDomain)
|
|
10
|
+
.map((we) => we.domain.rootDomain);
|
|
11
|
+
const domainProxyRootDomains = qpqWebServerUtils
|
|
12
|
+
.getDomainProxyConfigs(props.qpqConfig)
|
|
13
|
+
.filter((we) => !we.domain.onRootDomain)
|
|
14
|
+
.map((we) => we.domain.rootDomain);
|
|
15
|
+
const websocketRootDomains = qpqWebServerUtils
|
|
16
|
+
.getOwnedWebsocketSettings(props.qpqConfig)
|
|
17
|
+
.filter((we) => !we.onRootDomain)
|
|
18
|
+
.map((we) => we.rootDomain);
|
|
19
|
+
const uniqueRootDomains = [
|
|
20
|
+
...new Set([...webEntryRootDomains, ...domainProxyRootDomains, ...websocketRootDomains]),
|
|
21
|
+
];
|
|
22
|
+
for (const rootDomain of uniqueRootDomains) {
|
|
23
|
+
new ServiceDomainConstruct(this, `domain-${rootDomain}`, {
|
|
24
|
+
awsAccountId: props.awsAccountId,
|
|
25
|
+
qpqConfig: props.qpqConfig,
|
|
26
|
+
rootDomain,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_lambda } from 'aws-cdk-lib';
|
|
4
|
+
export interface LambdaLayersProps extends QpqConstructBlockProps {
|
|
5
|
+
}
|
|
6
|
+
export declare class LambdaLayers extends QpqConstructBlock {
|
|
7
|
+
readonly layers: aws_lambda.ILayerVersion[];
|
|
8
|
+
constructor(scope: Construct, id: string, props: LambdaLayersProps);
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { awsNamingUtils } from 'quidproquo-actionprocessor-awslambda';
|
|
2
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
3
|
+
import { aws_lambda } from 'aws-cdk-lib';
|
|
4
|
+
import { getLambdaLayersWithFullPaths } from 'quidproquo-config-aws';
|
|
5
|
+
export class LambdaLayers extends QpqConstructBlock {
|
|
6
|
+
layers;
|
|
7
|
+
constructor(scope, id, props) {
|
|
8
|
+
super(scope, id, props);
|
|
9
|
+
const apiLayers = getLambdaLayersWithFullPaths(props.qpqConfig);
|
|
10
|
+
this.layers = apiLayers.map((layer) => {
|
|
11
|
+
return layer.buildPath
|
|
12
|
+
? new aws_lambda.LayerVersion(this, `${layer.name}-layer`, {
|
|
13
|
+
layerVersionName: awsNamingUtils.getQpqRuntimeResourceNameFromConfig(layer.name, props.qpqConfig),
|
|
14
|
+
code: new aws_lambda.AssetCode(layer.buildPath),
|
|
15
|
+
compatibleRuntimes: [aws_lambda.Runtime.NODEJS_18_X],
|
|
16
|
+
})
|
|
17
|
+
: aws_lambda.LayerVersion.fromLayerVersionArn(this, `${layer.name}-layer-ref`, layer.layerArn);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_s3, aws_iam, aws_dynamodb } from 'aws-cdk-lib';
|
|
4
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
5
|
+
import { QpqResource } from '../base';
|
|
6
|
+
export interface LogStorageProps extends QpqConstructBlockProps {
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class LogStorageConstructBase extends QpqConstructBlock implements QpqResource {
|
|
9
|
+
abstract bucket: aws_s3.IBucket;
|
|
10
|
+
abstract storyResultsTable: aws_dynamodb.ITable;
|
|
11
|
+
abstract fromStoryResultsTable: aws_dynamodb.ITable;
|
|
12
|
+
grantRead(grantee: aws_iam.IGrantable): void;
|
|
13
|
+
grantWrite(grantee: aws_iam.IGrantable): void;
|
|
14
|
+
grantAll(grantee: aws_iam.IGrantable): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class LogStorage extends QpqConstructBlock {
|
|
17
|
+
readonly bucket: aws_s3.IBucket;
|
|
18
|
+
readonly storyResultsTable: aws_dynamodb.ITable;
|
|
19
|
+
readonly fromStoryResultsTable: aws_dynamodb.ITable;
|
|
20
|
+
static fromOtherStack(scope: Construct, id: string, qpqConfig: QPQConfig, awsAccountId: string, serviceBucketName: string): QpqResource;
|
|
21
|
+
constructor(scope: Construct, id: string, props: LogStorageProps);
|
|
22
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { aws_s3, aws_dynamodb, aws_s3_notifications } from 'aws-cdk-lib';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
|
4
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
5
|
+
import { QPQ_LOG_BUCKET_NAME } from '../../constants';
|
|
6
|
+
import { Function } from './Function';
|
|
7
|
+
export class LogStorageConstructBase extends QpqConstructBlock {
|
|
8
|
+
grantRead(grantee) {
|
|
9
|
+
this.storyResultsTable.grantReadData(grantee);
|
|
10
|
+
this.fromStoryResultsTable.grantReadData(grantee);
|
|
11
|
+
this.bucket.grantRead(grantee);
|
|
12
|
+
}
|
|
13
|
+
grantWrite(grantee) {
|
|
14
|
+
this.storyResultsTable.grantWriteData(grantee);
|
|
15
|
+
this.fromStoryResultsTable.grantWriteData(grantee);
|
|
16
|
+
this.bucket.grantWrite(grantee);
|
|
17
|
+
}
|
|
18
|
+
grantAll(grantee) {
|
|
19
|
+
this.grantRead(grantee);
|
|
20
|
+
this.grantWrite(grantee);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class LogStorage extends QpqConstructBlock {
|
|
24
|
+
bucket;
|
|
25
|
+
storyResultsTable;
|
|
26
|
+
fromStoryResultsTable;
|
|
27
|
+
static fromOtherStack(scope, id, qpqConfig, awsAccountId, serviceBucketName) {
|
|
28
|
+
class Import extends LogStorageConstructBase {
|
|
29
|
+
bucket = aws_s3.Bucket.fromBucketName(scope, `${id}-log-storage`, this.qpqResourceName(serviceBucketName, 'log'));
|
|
30
|
+
storyResultsTable = aws_dynamodb.Table.fromTableName(scope, `${id}-log-table`, this.qpqResourceName(serviceBucketName, 'log'));
|
|
31
|
+
fromStoryResultsTable = aws_dynamodb.Table.fromTableName(scope, `${id}-flog-table`, this.qpqResourceName(serviceBucketName, 'flog'));
|
|
32
|
+
}
|
|
33
|
+
return new Import(scope, id, { qpqConfig, awsAccountId });
|
|
34
|
+
}
|
|
35
|
+
constructor(scope, id, props) {
|
|
36
|
+
super(scope, id, props);
|
|
37
|
+
this.bucket = new aws_s3.Bucket(this, 'bucket', {
|
|
38
|
+
bucketName: this.qpqResourceName(QPQ_LOG_BUCKET_NAME, 'log'),
|
|
39
|
+
// Disable public access to this bucket
|
|
40
|
+
publicReadAccess: false,
|
|
41
|
+
blockPublicAccess: aws_s3.BlockPublicAccess.BLOCK_ALL,
|
|
42
|
+
// Allow bucket to auto delete upon cdk:Destroy
|
|
43
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
44
|
+
autoDeleteObjects: true,
|
|
45
|
+
});
|
|
46
|
+
// Time based query over all logs for a given runtimeType
|
|
47
|
+
const storyResultsTable = new aws_dynamodb.Table(this, 'table', {
|
|
48
|
+
tableName: this.qpqResourceName(QPQ_LOG_BUCKET_NAME, 'log'),
|
|
49
|
+
partitionKey: { name: 'runtimeType', type: aws_dynamodb.AttributeType.STRING },
|
|
50
|
+
sortKey: { name: 'startedAtWithCorrelation', type: aws_dynamodb.AttributeType.STRING },
|
|
51
|
+
billingMode: aws_dynamodb.BillingMode.PAY_PER_REQUEST,
|
|
52
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
53
|
+
});
|
|
54
|
+
// Query by correlation
|
|
55
|
+
storyResultsTable.addGlobalSecondaryIndex({
|
|
56
|
+
indexName: 'CorrelationIndex',
|
|
57
|
+
partitionKey: { name: 'correlation', type: aws_dynamodb.AttributeType.STRING },
|
|
58
|
+
});
|
|
59
|
+
// Second table for the from logs ~ Second table because a GSI will dupe the data more then needed
|
|
60
|
+
// Also, we cant have a GSI on keys that can be undefined, this table will only contain
|
|
61
|
+
// logs with a fromCorrelation
|
|
62
|
+
const fromStoryResultsTable = new aws_dynamodb.Table(this, 'from-table', {
|
|
63
|
+
tableName: this.qpqResourceName(QPQ_LOG_BUCKET_NAME, 'flog'),
|
|
64
|
+
partitionKey: { name: 'fromCorrelation', type: aws_dynamodb.AttributeType.STRING },
|
|
65
|
+
sortKey: { name: 'startedAtWithCorrelation', type: aws_dynamodb.AttributeType.STRING },
|
|
66
|
+
billingMode: aws_dynamodb.BillingMode.PAY_PER_REQUEST,
|
|
67
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
68
|
+
});
|
|
69
|
+
this.storyResultsTable = storyResultsTable;
|
|
70
|
+
this.fromStoryResultsTable = fromStoryResultsTable;
|
|
71
|
+
// Create a lambda that is trigged when files are written to the bucket
|
|
72
|
+
const func = new Function(this, 'function', {
|
|
73
|
+
buildPath: path.join(__dirname, '../..'),
|
|
74
|
+
functionName: this.qpqResourceName(QPQ_LOG_BUCKET_NAME, 'log'),
|
|
75
|
+
functionType: 'lambdas',
|
|
76
|
+
executorName: 'executeS3FileWriteEvent',
|
|
77
|
+
srcFilename: 'lambdaS3FileWriteEvent_log',
|
|
78
|
+
qpqConfig: props.qpqConfig,
|
|
79
|
+
awsAccountId: props.awsAccountId,
|
|
80
|
+
});
|
|
81
|
+
// Grant the Lambda function read access to the S3 bucket / dynamo table
|
|
82
|
+
// this.bucket.grantRead(func.lambdaFunction);
|
|
83
|
+
// storyResultsTable.grantWriteData(func.lambdaFunction);
|
|
84
|
+
this.bucket.addEventNotification(aws_s3.EventType.OBJECT_CREATED, new aws_s3_notifications.LambdaDestination(func.lambdaFunction));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base';
|
|
3
|
+
export interface ServiceDomainConstructProps extends QpqConstructBlockProps {
|
|
4
|
+
rootDomain: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ServiceDomainConstruct extends QpqConstructBlock {
|
|
7
|
+
constructor(scope: Construct, id: string, props: ServiceDomainConstructProps);
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { aws_route53 } from 'aws-cdk-lib';
|
|
2
|
+
import { qpqCoreUtils } from 'quidproquo-core';
|
|
3
|
+
import { qpqWebServerUtils } from 'quidproquo-webserver';
|
|
4
|
+
import { QpqConstructBlock } from '../base';
|
|
5
|
+
export class ServiceDomainConstruct extends QpqConstructBlock {
|
|
6
|
+
constructor(scope, id, props) {
|
|
7
|
+
super(scope, id, props);
|
|
8
|
+
// example.com
|
|
9
|
+
// dev.example.com
|
|
10
|
+
const feature = qpqCoreUtils.getApplicationModuleFeature(props.qpqConfig);
|
|
11
|
+
const environment = qpqCoreUtils.getApplicationModuleEnvironment(props.qpqConfig);
|
|
12
|
+
const service = qpqCoreUtils.getApplicationModuleName(props.qpqConfig);
|
|
13
|
+
const domainRoot = qpqWebServerUtils.getDomainRoot(props.rootDomain, environment, feature);
|
|
14
|
+
// The hosted zone already setup
|
|
15
|
+
// development.example.com
|
|
16
|
+
// joecoady.development.example.com
|
|
17
|
+
// staging.example.com
|
|
18
|
+
// example.com
|
|
19
|
+
let apexHostedZone = aws_route53.HostedZone.fromLookup(this, 'hosted-zone', {
|
|
20
|
+
domainName: domainRoot,
|
|
21
|
+
});
|
|
22
|
+
// Root domain name for our service
|
|
23
|
+
// search.example.com
|
|
24
|
+
// search.development.example.com
|
|
25
|
+
// search.joecoady.development.example.com
|
|
26
|
+
const serviceDomainName = qpqWebServerUtils.constructServiceDomainName(props.rootDomain, environment, service, feature);
|
|
27
|
+
console.log(`ServiceDomain: ${serviceDomainName} on apex - $${domainRoot}`);
|
|
28
|
+
// Create the root hosted zone for our service
|
|
29
|
+
const serviceHostedZone = new aws_route53.HostedZone(this, 'service-hosted-zone', {
|
|
30
|
+
zoneName: serviceDomainName,
|
|
31
|
+
});
|
|
32
|
+
// Add the new NS Records to the root hosted zone so subdomains can be resolved
|
|
33
|
+
new aws_route53.NsRecord(this, 'service-ns-records', {
|
|
34
|
+
zone: apexHostedZone,
|
|
35
|
+
recordName: serviceDomainName,
|
|
36
|
+
values: serviceHostedZone.hostedZoneNameServers || [],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import { aws_route53, aws_certificatemanager, aws_apigateway } from 'aws-cdk-lib';
|
|
4
|
+
export interface SubdomainNameProps extends QpqConstructBlockProps {
|
|
5
|
+
subdomain: string;
|
|
6
|
+
apexDomain: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class SubdomainName extends QpqConstructBlock {
|
|
9
|
+
readonly domainName: aws_apigateway.DomainName;
|
|
10
|
+
readonly certificate: aws_certificatemanager.Certificate;
|
|
11
|
+
readonly targetARecord: aws_route53.RecordTarget;
|
|
12
|
+
readonly deployDomain: string;
|
|
13
|
+
constructor(scope: Construct, id: string, props: SubdomainNameProps);
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { QpqConstructBlock } from '../base/QpqConstructBlock';
|
|
2
|
+
import { aws_route53, aws_certificatemanager, aws_apigateway, aws_route53_targets, } from 'aws-cdk-lib';
|
|
3
|
+
export class SubdomainName extends QpqConstructBlock {
|
|
4
|
+
domainName;
|
|
5
|
+
certificate;
|
|
6
|
+
targetARecord;
|
|
7
|
+
deployDomain;
|
|
8
|
+
constructor(scope, id, props) {
|
|
9
|
+
super(scope, id, props);
|
|
10
|
+
this.deployDomain = `${props.subdomain}.${props.apexDomain}`;
|
|
11
|
+
const apexHostedZone = aws_route53.HostedZone.fromLookup(this, 'hosted-zone', {
|
|
12
|
+
domainName: props.apexDomain,
|
|
13
|
+
});
|
|
14
|
+
this.certificate = new aws_certificatemanager.Certificate(this, 'certificate', {
|
|
15
|
+
domainName: this.deployDomain,
|
|
16
|
+
certificateName: `${this.deployDomain}-cert`,
|
|
17
|
+
validation: aws_certificatemanager.CertificateValidation.fromDns(apexHostedZone),
|
|
18
|
+
});
|
|
19
|
+
this.domainName = new aws_apigateway.DomainName(this, 'domain-name', {
|
|
20
|
+
domainName: this.deployDomain,
|
|
21
|
+
certificate: this.certificate,
|
|
22
|
+
securityPolicy: aws_apigateway.SecurityPolicy.TLS_1_2,
|
|
23
|
+
endpointType: aws_apigateway.EndpointType.REGIONAL,
|
|
24
|
+
});
|
|
25
|
+
this.targetARecord = aws_route53.RecordTarget.fromAlias(new aws_route53_targets.ApiGatewayDomain(this.domainName));
|
|
26
|
+
new aws_route53.ARecord(this, 'a-record', {
|
|
27
|
+
zone: apexHostedZone,
|
|
28
|
+
recordName: this.deployDomain,
|
|
29
|
+
target: this.targetARecord,
|
|
30
|
+
});
|
|
31
|
+
// // Export the names so we can import them later
|
|
32
|
+
// new cdk.CfnOutput(this, 'HostedZoneID', {
|
|
33
|
+
// value: apexHostedZone.hostedZoneId,
|
|
34
|
+
// exportName: `${apexHostedZone}-hosted-zone-id`,
|
|
35
|
+
// });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
3
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
4
|
+
export interface WebserverRollProps extends QpqConstructBlockProps {
|
|
5
|
+
}
|
|
6
|
+
export declare class WebserverRoll extends QpqConstructBlock {
|
|
7
|
+
role: aws_iam.IRole;
|
|
8
|
+
constructor(scope: Construct, id: string, props: WebserverRollProps);
|
|
9
|
+
}
|