quidproquo-deploy-awscdk 0.0.201 → 0.0.202
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 +60 -60
- package/lib/commonjs/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.d.ts +1 -1
- package/lib/commonjs/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.js +4 -4
- package/lib/commonjs/stacks/InfQpqServiceStack.js +3 -2
- package/lib/esm/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.d.ts +1 -1
- package/lib/esm/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.js +4 -4
- package/lib/esm/stacks/InfQpqServiceStack.js +3 -2
- package/package.json +7 -7
- package/src/QPQApp.ts +5 -5
- package/src/constants/BootstrapResource.ts +3 -3
- package/src/constants/index.ts +3 -3
- package/src/constants/logging.ts +1 -1
- package/src/constants/warmLambdas.ts +3 -3
- package/src/constructs/base/QpqConstructBlock.ts +69 -69
- package/src/constructs/base/QpqResource.ts +24 -24
- package/src/constructs/base/index.ts +2 -2
- package/src/constructs/basic/BSQpqLambdaWarmerEventConstruct.ts +33 -33
- package/src/constructs/basic/DnsValidatedCertificate.ts +61 -61
- package/src/constructs/basic/Function.ts +91 -91
- package/src/constructs/basic/InfQpqWebserverServiceDomainsConstruct.ts +41 -41
- package/src/constructs/basic/LambdaLayers.ts +34 -34
- package/src/constructs/basic/LogStorage.ts +140 -140
- package/src/constructs/basic/ServiceDomain.ts +61 -61
- package/src/constructs/basic/SubdomainName.ts +60 -60
- package/src/constructs/basic/WebserverRoll.ts +106 -106
- package/src/constructs/basic/index.ts +6 -6
- package/src/constructs/feature/config/alarm/QpqConfigAwsAlarm.ts +74 -74
- package/src/constructs/feature/config/alarm/index.ts +1 -1
- package/src/constructs/feature/config/index.ts +1 -1
- package/src/constructs/feature/core/auth/QpqCoreUserDirectoryConstruct.ts +189 -216
- package/src/constructs/feature/core/auth/index.ts +1 -1
- package/src/constructs/feature/core/deployEvents/QpqCoreDeployEventConstruct.ts +53 -53
- package/src/constructs/feature/core/deployEvents/index.ts +1 -1
- package/src/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.ts +101 -101
- package/src/constructs/feature/core/eventBus/index.ts +1 -1
- package/src/constructs/feature/core/index.ts +9 -9
- package/src/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.ts +148 -148
- package/src/constructs/feature/core/keyValueStore/index.ts +1 -1
- package/src/constructs/feature/core/parameter/QpqCoreParameterConstruct.ts +104 -104
- package/src/constructs/feature/core/parameter/index.ts +1 -1
- package/src/constructs/feature/core/queue/QpqApiCoreQueueConstruct.ts +112 -112
- package/src/constructs/feature/core/queue/QpqCoreQueueConstruct.ts +126 -126
- package/src/constructs/feature/core/queue/index.ts +2 -2
- package/src/constructs/feature/core/schedule/QpqCoreRecurringScheduleConstruct.ts +55 -55
- package/src/constructs/feature/core/schedule/index.ts +1 -1
- package/src/constructs/feature/core/secret/QpqCoreSecretConstruct.ts +102 -102
- package/src/constructs/feature/core/secret/index.ts +1 -1
- package/src/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.ts +95 -95
- package/src/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.ts +187 -187
- package/src/constructs/feature/core/storageDrive/index.ts +2 -2
- package/src/constructs/feature/index.ts +3 -3
- package/src/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.ts +59 -59
- package/src/constructs/feature/webserver/api/BootstrapQpqWebserverApiConstruct.ts +34 -34
- package/src/constructs/feature/webserver/api/index.ts +2 -2
- package/src/constructs/feature/webserver/apiKey/QpqWebserverApiKeyConstruct.ts +35 -35
- package/src/constructs/feature/webserver/apiKey/index.ts +1 -1
- package/src/constructs/feature/webserver/cache/QpqWebServerCacheConstruct.ts +79 -79
- package/src/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.ts +27 -27
- package/src/constructs/feature/webserver/certificate/index.ts +1 -1
- package/src/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.ts +61 -61
- package/src/constructs/feature/webserver/domain/index.ts +1 -1
- package/src/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.ts +119 -119
- package/src/constructs/feature/webserver/domainProxy/index.ts +1 -1
- package/src/constructs/feature/webserver/index.ts +9 -9
- package/src/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.ts +77 -77
- package/src/constructs/feature/webserver/redirect/index.ts +1 -1
- package/src/constructs/feature/webserver/serviceFunction/QpqWebserverServiceFunctionConstruct.ts +42 -42
- package/src/constructs/feature/webserver/serviceFunction/index.ts +1 -1
- package/src/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.ts +278 -278
- package/src/constructs/feature/webserver/webEntry/index.ts +1 -1
- package/src/constructs/feature/webserver/webEntry/utils/securityHeaders.ts +202 -202
- package/src/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.ts +127 -127
- package/src/constructs/feature/webserver/websocket/QpqWebserverWebsocketConstruct.ts +36 -36
- package/src/constructs/feature/webserver/websocket/index.ts +2 -2
- package/src/constructs/index.ts +3 -3
- package/src/index.ts +6 -6
- package/src/lambdas/actionProcessorListResolver.ts +3 -3
- package/src/lambdas/dynamicModuleLoader/dynamicModuleLoader.ts +17 -17
- package/src/lambdas/dynamicModuleLoader/dynamicModuleLoaderWarmer.ts +7 -7
- package/src/lambdas/dynamicModuleLoader/index.ts +2 -2
- package/src/lambdas/index.ts +5 -5
- package/src/lambdas/lambda-utils/getLambdaActionProcessors.ts +60 -60
- package/src/lambdas/lambda-utils/getQpqLambdaRuntimeForEvent.ts +92 -92
- package/src/lambdas/lambda-utils/getRuntimeCorrelation.ts +7 -7
- package/src/lambdas/lambda-utils/index.ts +5 -5
- package/src/lambdas/lambda-utils/logger.ts +141 -141
- package/src/lambdas/lambda-utils/qpqFunctionMiddleware.ts +63 -63
- package/src/lambdas/lambdaAPIGatewayEvent.ts +21 -21
- package/src/lambdas/lambdaAPIGatewayEvent_redirect.ts +54 -54
- package/src/lambdas/lambdaCognitoTriggerEvent_CustomMessage.ts +18 -18
- package/src/lambdas/lambdaConfig.ts +14 -14
- package/src/lambdas/lambdaEventBridgeEvent.ts +18 -18
- package/src/lambdas/lambdaEventBridgeEventStackDeploy.ts +17 -17
- package/src/lambdas/lambdaEventOriginRequest.ts +16 -16
- package/src/lambdas/lambdaEventViewerRequest.ts +38 -38
- package/src/lambdas/lambdaS3FileEvent.ts +18 -18
- package/src/lambdas/lambdaSQSEvent.ts +18 -18
- package/src/lambdas/lambdaServiceFunctionExecute.ts +20 -20
- package/src/lambdas/lambdaWebsocketAPIGatewayEvent.ts +22 -22
- package/src/stacks/ApiQpqServiceStack.ts +153 -153
- package/src/stacks/BootstrapQpqServiceStack.ts +32 -32
- package/src/stacks/InfQpqServiceStack.ts +174 -185
- package/src/stacks/WebQpqServiceStack.ts +52 -52
- package/src/stacks/base/QpqServiceStack.ts +32 -32
- package/src/stacks/index.ts +4 -4
- package/src/types/QpqWarmLambdaEvent.ts +5 -5
- package/src/types/index.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/qpqAwsCdkNamingUtils.ts +7 -7
- package/src/utils/qpqDeployAwsCdkUtils.ts +279 -279
package/README.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# quidproquo-deploy-awscdk
|
|
2
|
-
|
|
3
|
-
The `quidproquo-deploy-awscdk` library is a key component of the quidproquo framework, providing a set of constructs and utilities for deploying quidproquo-based applications on the AWS Cloud using the AWS CDK (Cloud Development Kit).
|
|
4
|
-
|
|
5
|
-
## WARNING: NOT FOR PRODUCTION
|
|
6
|
-
|
|
7
|
-
**This project is currently under active development and should not be used in production environments. The APIs and functionality are subject to change without notice.**
|
|
8
|
-
|
|
9
|
-
## Key Features
|
|
10
|
-
|
|
11
|
-
1. **Construct-based Deployment**: The `quidproquo-deploy-awscdk` library provides a set of custom constructs that encapsulate the deployment of various quidproquo components, such as APIs, queues, storage drives, and more, on the AWS platform.
|
|
12
|
-
|
|
13
|
-
2. **Seamless Integration**: The constructs in this library are designed to work seamlessly with the core quidproquo functionality, ensuring a consistent and cohesive development experience.
|
|
14
|
-
|
|
15
|
-
3. **Extensibility**: The library is designed to be highly extensible, allowing developers to create custom constructs or modify existing ones to meet their specific requirements.
|
|
16
|
-
|
|
17
|
-
4. **Automated Provisioning**: The library handles the provisioning of various AWS resources, such as Lambda functions, API Gateways, DynamoDB tables, and more, based on the quidproquo configuration.
|
|
18
|
-
|
|
19
|
-
5. **Dependency Management**: The library manages the dependencies between various quidproquo components, ensuring that the deployment process is efficient and reliable.
|
|
20
|
-
|
|
21
|
-
6. **Logging and Observability**: The library integrates with the quidproquo logging and observability features, ensuring that deployment-related logs and metrics are captured and made available for monitoring and troubleshooting.
|
|
22
|
-
|
|
23
|
-
7. **Reusable Constructs**: The library provides a set of reusable constructs that can be used across multiple quidproquo-based applications, promoting code reuse and consistency.
|
|
24
|
-
|
|
25
|
-
## Key Concepts
|
|
26
|
-
|
|
27
|
-
1. **Constructs**: Constructs are the fundamental building blocks of the `quidproquo-deploy-awscdk` library. They represent the various AWS resources and configurations required to deploy a quidproquo-based application.
|
|
28
|
-
|
|
29
|
-
2. **Stacks**: Stacks are higher-level constructs that group related resources and configurations together, ensuring a cohesive and organized deployment process.
|
|
30
|
-
|
|
31
|
-
3. **Dependency Management**: The library manages the dependencies between various quidproquo components, ensuring that the deployment process is efficient and reliable.
|
|
32
|
-
|
|
33
|
-
4. **Naming Conventions**: The library follows a consistent naming convention for the provisioned AWS resources, ensuring that they are easily identifiable and traceable.
|
|
34
|
-
|
|
35
|
-
5. **Extensibility**: The library is designed to be highly extensible, allowing developers to create custom constructs or modify existing ones to meet their specific requirements.
|
|
36
|
-
|
|
37
|
-
6. **Logging and Observability**: The library integrates with the quidproquo logging and observability features, ensuring that deployment-related logs and metrics are captured and made available for monitoring and troubleshooting.
|
|
38
|
-
|
|
39
|
-
7. **Reusable Constructs**: The library provides a set of reusable constructs that can be used across multiple quidproquo-based applications, promoting code reuse and consistency.
|
|
40
|
-
|
|
41
|
-
## Getting Started
|
|
42
|
-
|
|
43
|
-
To use the `quidproquo-deploy-awscdk` library, you'll need to install the package and its dependencies. You can do this using your preferred package manager, such as npm or yarn:
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
npm install quidproquo-deploy-awscdk
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Once you have the package installed, you can start building your quidproquo-based applications on the AWS platform, leveraging the constructs and utilities provided by this library.
|
|
50
|
-
|
|
51
|
-
## Documentation
|
|
52
|
-
|
|
53
|
-
For more detailed information on using the `quidproquo-deploy-awscdk` library, please refer to the [quidproquo-deploy-awscdk documentation](https://github.com/joe-coady/quidproquo/tree/main/packages/quidproquo-deploy-awscdk).
|
|
54
|
-
|
|
55
|
-
## Contributing
|
|
56
|
-
|
|
57
|
-
If you'd like to contribute to the development of `quidproquo-deploy-awscdk`, please refer to the [contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information.
|
|
58
|
-
|
|
59
|
-
## License
|
|
60
|
-
|
|
1
|
+
# quidproquo-deploy-awscdk
|
|
2
|
+
|
|
3
|
+
The `quidproquo-deploy-awscdk` library is a key component of the quidproquo framework, providing a set of constructs and utilities for deploying quidproquo-based applications on the AWS Cloud using the AWS CDK (Cloud Development Kit).
|
|
4
|
+
|
|
5
|
+
## WARNING: NOT FOR PRODUCTION
|
|
6
|
+
|
|
7
|
+
**This project is currently under active development and should not be used in production environments. The APIs and functionality are subject to change without notice.**
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
1. **Construct-based Deployment**: The `quidproquo-deploy-awscdk` library provides a set of custom constructs that encapsulate the deployment of various quidproquo components, such as APIs, queues, storage drives, and more, on the AWS platform.
|
|
12
|
+
|
|
13
|
+
2. **Seamless Integration**: The constructs in this library are designed to work seamlessly with the core quidproquo functionality, ensuring a consistent and cohesive development experience.
|
|
14
|
+
|
|
15
|
+
3. **Extensibility**: The library is designed to be highly extensible, allowing developers to create custom constructs or modify existing ones to meet their specific requirements.
|
|
16
|
+
|
|
17
|
+
4. **Automated Provisioning**: The library handles the provisioning of various AWS resources, such as Lambda functions, API Gateways, DynamoDB tables, and more, based on the quidproquo configuration.
|
|
18
|
+
|
|
19
|
+
5. **Dependency Management**: The library manages the dependencies between various quidproquo components, ensuring that the deployment process is efficient and reliable.
|
|
20
|
+
|
|
21
|
+
6. **Logging and Observability**: The library integrates with the quidproquo logging and observability features, ensuring that deployment-related logs and metrics are captured and made available for monitoring and troubleshooting.
|
|
22
|
+
|
|
23
|
+
7. **Reusable Constructs**: The library provides a set of reusable constructs that can be used across multiple quidproquo-based applications, promoting code reuse and consistency.
|
|
24
|
+
|
|
25
|
+
## Key Concepts
|
|
26
|
+
|
|
27
|
+
1. **Constructs**: Constructs are the fundamental building blocks of the `quidproquo-deploy-awscdk` library. They represent the various AWS resources and configurations required to deploy a quidproquo-based application.
|
|
28
|
+
|
|
29
|
+
2. **Stacks**: Stacks are higher-level constructs that group related resources and configurations together, ensuring a cohesive and organized deployment process.
|
|
30
|
+
|
|
31
|
+
3. **Dependency Management**: The library manages the dependencies between various quidproquo components, ensuring that the deployment process is efficient and reliable.
|
|
32
|
+
|
|
33
|
+
4. **Naming Conventions**: The library follows a consistent naming convention for the provisioned AWS resources, ensuring that they are easily identifiable and traceable.
|
|
34
|
+
|
|
35
|
+
5. **Extensibility**: The library is designed to be highly extensible, allowing developers to create custom constructs or modify existing ones to meet their specific requirements.
|
|
36
|
+
|
|
37
|
+
6. **Logging and Observability**: The library integrates with the quidproquo logging and observability features, ensuring that deployment-related logs and metrics are captured and made available for monitoring and troubleshooting.
|
|
38
|
+
|
|
39
|
+
7. **Reusable Constructs**: The library provides a set of reusable constructs that can be used across multiple quidproquo-based applications, promoting code reuse and consistency.
|
|
40
|
+
|
|
41
|
+
## Getting Started
|
|
42
|
+
|
|
43
|
+
To use the `quidproquo-deploy-awscdk` library, you'll need to install the package and its dependencies. You can do this using your preferred package manager, such as npm or yarn:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
npm install quidproquo-deploy-awscdk
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Once you have the package installed, you can start building your quidproquo-based applications on the AWS platform, leveraging the constructs and utilities provided by this library.
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
For more detailed information on using the `quidproquo-deploy-awscdk` library, please refer to the [quidproquo-deploy-awscdk documentation](https://github.com/joe-coady/quidproquo/tree/main/packages/quidproquo-deploy-awscdk).
|
|
54
|
+
|
|
55
|
+
## Contributing
|
|
56
|
+
|
|
57
|
+
If you'd like to contribute to the development of `quidproquo-deploy-awscdk`, please refer to the [contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
61
|
`quidproquo-deploy-awscdk` is licensed under the [MIT License](https://github.com/joe-coady/quidproquo/blob/main/LICENSE).
|
|
@@ -16,5 +16,5 @@ export declare class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryC
|
|
|
16
16
|
userPool: aws_cognito.IUserPool;
|
|
17
17
|
static fromOtherStack(scope: Construct, id: string, qpqConfig: QPQConfig, awsAccountId: string, userDirectoryName: string): QpqResource;
|
|
18
18
|
constructor(scope: Construct, id: string, props: QpqCoreUserDirectoryConstructProps);
|
|
19
|
-
static authorizeActionsForRole(role: aws_iam.IRole,
|
|
19
|
+
static authorizeActionsForRole(role: aws_iam.IRole, userDirectoryConfigs: UserDirectoryQPQConfigSetting[], userDirectoryConstructs: QpqCoreUserDirectoryConstruct[], qpqConfig: QPQConfig): void;
|
|
20
20
|
}
|
|
@@ -107,8 +107,8 @@ class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryConstructBase {
|
|
|
107
107
|
});
|
|
108
108
|
qpqDeployAwsCdkUtils.exportStackValue(this, quidproquo_actionprocessor_awslambda_1.awsNamingUtils.getCFExportNameUserPoolClientIdFromConfig(props.userDirectoryConfig.name, props.qpqConfig), userPoolClient.userPoolClientId);
|
|
109
109
|
}
|
|
110
|
-
static authorizeActionsForRole(role,
|
|
111
|
-
if (
|
|
110
|
+
static authorizeActionsForRole(role, userDirectoryConfigs, userDirectoryConstructs, qpqConfig) {
|
|
111
|
+
if (userDirectoryConstructs.length > 0) {
|
|
112
112
|
role.addToPrincipalPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
|
|
113
113
|
effect: aws_cdk_lib_1.aws_iam.Effect.ALLOW,
|
|
114
114
|
actions: [
|
|
@@ -130,9 +130,9 @@ class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryConstructBase {
|
|
|
130
130
|
'cognito-idp:DescribeUserPool',
|
|
131
131
|
'cognito-idp:DescribeUserPoolClient',
|
|
132
132
|
],
|
|
133
|
-
resources:
|
|
133
|
+
resources: userDirectoryConfigs.map((userDirectoryConfig, index) => {
|
|
134
134
|
const { awsRegion, awsAccountId } = (0, quidproquo_config_aws_1.resolveAwsServiceAccountInfo)(qpqConfig, userDirectoryConfig.owner);
|
|
135
|
-
const userpoolId =
|
|
135
|
+
const userpoolId = userDirectoryConstructs[index].userPool.userPoolId;
|
|
136
136
|
return `arn:aws:cognito-idp:${awsRegion}:${awsAccountId}:userpool/${userpoolId}`;
|
|
137
137
|
}),
|
|
138
138
|
}));
|
|
@@ -53,12 +53,13 @@ class InfQpqServiceStack extends QpqServiceStack_1.QpqServiceStack {
|
|
|
53
53
|
constructs_1.QpqCoreQueueConstruct.authorizeActionsForRole(webserverRole, queues);
|
|
54
54
|
// end queues
|
|
55
55
|
// User Directories
|
|
56
|
-
const
|
|
56
|
+
const ownedUserDirectoriesConfigs = quidproquo_core_1.qpqCoreUtils.getOwnedUserDirectories(props.qpqConfig);
|
|
57
|
+
const userDirectories = ownedUserDirectoriesConfigs.map((setting) => new constructs_1.QpqCoreUserDirectoryConstruct(this, quidproquo_core_1.qpqCoreUtils.getUniqueKeyForSetting(setting), {
|
|
57
58
|
awsAccountId: props.awsAccountId,
|
|
58
59
|
qpqConfig: props.qpqConfig,
|
|
59
60
|
userDirectoryConfig: setting,
|
|
60
61
|
}));
|
|
61
|
-
constructs_1.QpqCoreUserDirectoryConstruct.authorizeActionsForRole(webserverRole,
|
|
62
|
+
constructs_1.QpqCoreUserDirectoryConstruct.authorizeActionsForRole(webserverRole, ownedUserDirectoriesConfigs, userDirectories, props.qpqConfig);
|
|
62
63
|
// Api Keys
|
|
63
64
|
const apiKeys = quidproquo_webserver_1.qpqWebServerUtils.getAllApiKeyConfigs(props.qpqConfig).map((setting) => new constructs_1.QpqWebserverApiKeyConstruct(this, quidproquo_core_1.qpqCoreUtils.getUniqueKeyForSetting(setting), {
|
|
64
65
|
awsAccountId: props.awsAccountId,
|
|
@@ -16,5 +16,5 @@ export declare class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryC
|
|
|
16
16
|
userPool: aws_cognito.IUserPool;
|
|
17
17
|
static fromOtherStack(scope: Construct, id: string, qpqConfig: QPQConfig, awsAccountId: string, userDirectoryName: string): QpqResource;
|
|
18
18
|
constructor(scope: Construct, id: string, props: QpqCoreUserDirectoryConstructProps);
|
|
19
|
-
static authorizeActionsForRole(role: aws_iam.IRole,
|
|
19
|
+
static authorizeActionsForRole(role: aws_iam.IRole, userDirectoryConfigs: UserDirectoryQPQConfigSetting[], userDirectoryConstructs: QpqCoreUserDirectoryConstruct[], qpqConfig: QPQConfig): void;
|
|
20
20
|
}
|
|
@@ -78,8 +78,8 @@ export class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryConstruct
|
|
|
78
78
|
});
|
|
79
79
|
qpqDeployAwsCdkUtils.exportStackValue(this, awsNamingUtils.getCFExportNameUserPoolClientIdFromConfig(props.userDirectoryConfig.name, props.qpqConfig), userPoolClient.userPoolClientId);
|
|
80
80
|
}
|
|
81
|
-
static authorizeActionsForRole(role,
|
|
82
|
-
if (
|
|
81
|
+
static authorizeActionsForRole(role, userDirectoryConfigs, userDirectoryConstructs, qpqConfig) {
|
|
82
|
+
if (userDirectoryConstructs.length > 0) {
|
|
83
83
|
role.addToPrincipalPolicy(new aws_iam.PolicyStatement({
|
|
84
84
|
effect: aws_iam.Effect.ALLOW,
|
|
85
85
|
actions: [
|
|
@@ -101,9 +101,9 @@ export class QpqCoreUserDirectoryConstruct extends QpqCoreUserDirectoryConstruct
|
|
|
101
101
|
'cognito-idp:DescribeUserPool',
|
|
102
102
|
'cognito-idp:DescribeUserPoolClient',
|
|
103
103
|
],
|
|
104
|
-
resources:
|
|
104
|
+
resources: userDirectoryConfigs.map((userDirectoryConfig, index) => {
|
|
105
105
|
const { awsRegion, awsAccountId } = resolveAwsServiceAccountInfo(qpqConfig, userDirectoryConfig.owner);
|
|
106
|
-
const userpoolId =
|
|
106
|
+
const userpoolId = userDirectoryConstructs[index].userPool.userPoolId;
|
|
107
107
|
return `arn:aws:cognito-idp:${awsRegion}:${awsAccountId}:userpool/${userpoolId}`;
|
|
108
108
|
}),
|
|
109
109
|
}));
|
|
@@ -50,12 +50,13 @@ export class InfQpqServiceStack extends QpqServiceStack {
|
|
|
50
50
|
QpqCoreQueueConstruct.authorizeActionsForRole(webserverRole, queues);
|
|
51
51
|
// end queues
|
|
52
52
|
// User Directories
|
|
53
|
-
const
|
|
53
|
+
const ownedUserDirectoriesConfigs = qpqCoreUtils.getOwnedUserDirectories(props.qpqConfig);
|
|
54
|
+
const userDirectories = ownedUserDirectoriesConfigs.map((setting) => new QpqCoreUserDirectoryConstruct(this, qpqCoreUtils.getUniqueKeyForSetting(setting), {
|
|
54
55
|
awsAccountId: props.awsAccountId,
|
|
55
56
|
qpqConfig: props.qpqConfig,
|
|
56
57
|
userDirectoryConfig: setting,
|
|
57
58
|
}));
|
|
58
|
-
QpqCoreUserDirectoryConstruct.authorizeActionsForRole(webserverRole,
|
|
59
|
+
QpqCoreUserDirectoryConstruct.authorizeActionsForRole(webserverRole, ownedUserDirectoriesConfigs, userDirectories, props.qpqConfig);
|
|
59
60
|
// Api Keys
|
|
60
61
|
const apiKeys = qpqWebServerUtils.getAllApiKeyConfigs(props.qpqConfig).map((setting) => new QpqWebserverApiKeyConstruct(this, qpqCoreUtils.getUniqueKeyForSetting(setting), {
|
|
61
62
|
awsAccountId: props.awsAccountId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-deploy-awscdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.202",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"constructs": "^10.1.208",
|
|
36
36
|
"esbuild": "^0.15.16",
|
|
37
37
|
"liquidjs": "^10.7.0",
|
|
38
|
-
"quidproquo-actionprocessor-awslambda": "0.0.
|
|
39
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
40
|
-
"quidproquo-config-aws": "0.0.
|
|
41
|
-
"quidproquo-core": "0.0.
|
|
42
|
-
"quidproquo-webserver": "0.0.
|
|
38
|
+
"quidproquo-actionprocessor-awslambda": "0.0.202",
|
|
39
|
+
"quidproquo-actionprocessor-node": "0.0.202",
|
|
40
|
+
"quidproquo-config-aws": "0.0.202",
|
|
41
|
+
"quidproquo-core": "0.0.202",
|
|
42
|
+
"quidproquo-webserver": "0.0.202"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/aws-lambda": "^8.10.109",
|
|
46
46
|
"@types/babel__traverse": "7.18.2",
|
|
47
47
|
"@types/node": "^20.2.1",
|
|
48
48
|
"@types/prettier": "2.6.0",
|
|
49
|
-
"quidproquo-tsconfig": "0.0.
|
|
49
|
+
"quidproquo-tsconfig": "0.0.202",
|
|
50
50
|
"ts-node": "^10.9.1",
|
|
51
51
|
"typescript": "^4.9.3"
|
|
52
52
|
}
|
package/src/QPQApp.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as cdk from 'aws-cdk-lib';
|
|
2
|
-
|
|
3
|
-
export const createQPQApp = (): cdk.App => {
|
|
4
|
-
return new cdk.App();
|
|
5
|
-
};
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
|
|
3
|
+
export const createQPQApp = (): cdk.App => {
|
|
4
|
+
return new cdk.App();
|
|
5
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export enum BootstrapResource {
|
|
2
|
-
WarmLambdas = 'WarmLambdas',
|
|
3
|
-
}
|
|
1
|
+
export enum BootstrapResource {
|
|
2
|
+
WarmLambdas = 'WarmLambdas',
|
|
3
|
+
}
|
package/src/constants/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './logging';
|
|
2
|
-
export * from './warmLambdas';
|
|
3
|
-
export * from './BootstrapResource';
|
|
1
|
+
export * from './logging';
|
|
2
|
+
export * from './warmLambdas';
|
|
3
|
+
export * from './BootstrapResource';
|
package/src/constants/logging.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const QPQ_LOG_BUCKET_NAME = 'logs';
|
|
1
|
+
export const QPQ_LOG_BUCKET_NAME = 'logs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { QpqWarmLambdaEvent } from '../types';
|
|
2
|
-
|
|
3
|
-
export const WARM_LAMBDA_EVENT: QpqWarmLambdaEvent = { qpqWarm: true };
|
|
1
|
+
import { QpqWarmLambdaEvent } from '../types';
|
|
2
|
+
|
|
3
|
+
export const WARM_LAMBDA_EVENT: QpqWarmLambdaEvent = { qpqWarm: true };
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { awsNamingUtils } from 'quidproquo-actionprocessor-awslambda';
|
|
2
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
3
|
-
import { Construct } from 'constructs';
|
|
4
|
-
|
|
5
|
-
import { QpqResource } from './QpqResource';
|
|
6
|
-
import { IGrantable, IRole } from 'aws-cdk-lib/aws-iam';
|
|
7
|
-
import { aws_iam } from 'aws-cdk-lib';
|
|
8
|
-
|
|
9
|
-
export interface QpqConstructBlockProps {
|
|
10
|
-
awsAccountId: string;
|
|
11
|
-
qpqConfig: QPQConfig;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class QpqConstructBlock extends Construct implements QpqResource {
|
|
15
|
-
awsAccountId: string;
|
|
16
|
-
qpqConfig: QPQConfig;
|
|
17
|
-
serviceRole?: aws_iam.IRole;
|
|
18
|
-
|
|
19
|
-
constructor(scope: Construct, id: string, props: QpqConstructBlockProps) {
|
|
20
|
-
super(scope, id);
|
|
21
|
-
|
|
22
|
-
this.awsAccountId = props.awsAccountId;
|
|
23
|
-
this.qpqConfig = props.qpqConfig;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
resourceName(name: string) {
|
|
27
|
-
return awsNamingUtils.getConfigRuntimeResourceNameFromConfig(name, this.qpqConfig);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
resourceNameWithModuleOveride(name: string, module?: string) {
|
|
31
|
-
return awsNamingUtils.getConfigRuntimeResourceNameFromConfigWithServiceOverride(
|
|
32
|
-
name,
|
|
33
|
-
this.qpqConfig,
|
|
34
|
-
module,
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
qpqResourceName(name: string, resourceType: string) {
|
|
39
|
-
return awsNamingUtils.getQpqRuntimeResourceNameFromConfig(name, this.qpqConfig, resourceType);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
qpqBootstrapResourceName(name: string) {
|
|
43
|
-
return awsNamingUtils.getConfigRuntimeBootstrapResourceNameFromConfig(name, this.qpqConfig);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
grantRead(grantee: IGrantable): void {}
|
|
47
|
-
|
|
48
|
-
grantWrite(grantee: IGrantable): void {}
|
|
49
|
-
|
|
50
|
-
grantAll(grantee: IGrantable): void {
|
|
51
|
-
this.grantRead(grantee);
|
|
52
|
-
this.grantWrite(grantee);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getServiceRole(): aws_iam.IRole {
|
|
56
|
-
if (!this.serviceRole) {
|
|
57
|
-
this.serviceRole = aws_iam.Role.fromRoleName(
|
|
58
|
-
this,
|
|
59
|
-
'service-role',
|
|
60
|
-
this.resourceName('service-role'),
|
|
61
|
-
{
|
|
62
|
-
mutable: true,
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return this.serviceRole;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
import { awsNamingUtils } from 'quidproquo-actionprocessor-awslambda';
|
|
2
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
3
|
+
import { Construct } from 'constructs';
|
|
4
|
+
|
|
5
|
+
import { QpqResource } from './QpqResource';
|
|
6
|
+
import { IGrantable, IRole } from 'aws-cdk-lib/aws-iam';
|
|
7
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
8
|
+
|
|
9
|
+
export interface QpqConstructBlockProps {
|
|
10
|
+
awsAccountId: string;
|
|
11
|
+
qpqConfig: QPQConfig;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class QpqConstructBlock extends Construct implements QpqResource {
|
|
15
|
+
awsAccountId: string;
|
|
16
|
+
qpqConfig: QPQConfig;
|
|
17
|
+
serviceRole?: aws_iam.IRole;
|
|
18
|
+
|
|
19
|
+
constructor(scope: Construct, id: string, props: QpqConstructBlockProps) {
|
|
20
|
+
super(scope, id);
|
|
21
|
+
|
|
22
|
+
this.awsAccountId = props.awsAccountId;
|
|
23
|
+
this.qpqConfig = props.qpqConfig;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
resourceName(name: string) {
|
|
27
|
+
return awsNamingUtils.getConfigRuntimeResourceNameFromConfig(name, this.qpqConfig);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
resourceNameWithModuleOveride(name: string, module?: string) {
|
|
31
|
+
return awsNamingUtils.getConfigRuntimeResourceNameFromConfigWithServiceOverride(
|
|
32
|
+
name,
|
|
33
|
+
this.qpqConfig,
|
|
34
|
+
module,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
qpqResourceName(name: string, resourceType: string) {
|
|
39
|
+
return awsNamingUtils.getQpqRuntimeResourceNameFromConfig(name, this.qpqConfig, resourceType);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
qpqBootstrapResourceName(name: string) {
|
|
43
|
+
return awsNamingUtils.getConfigRuntimeBootstrapResourceNameFromConfig(name, this.qpqConfig);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
grantRead(grantee: IGrantable): void {}
|
|
47
|
+
|
|
48
|
+
grantWrite(grantee: IGrantable): void {}
|
|
49
|
+
|
|
50
|
+
grantAll(grantee: IGrantable): void {
|
|
51
|
+
this.grantRead(grantee);
|
|
52
|
+
this.grantWrite(grantee);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getServiceRole(): aws_iam.IRole {
|
|
56
|
+
if (!this.serviceRole) {
|
|
57
|
+
this.serviceRole = aws_iam.Role.fromRoleName(
|
|
58
|
+
this,
|
|
59
|
+
'service-role',
|
|
60
|
+
this.resourceName('service-role'),
|
|
61
|
+
{
|
|
62
|
+
mutable: true,
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return this.serviceRole;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { aws_iam } from 'aws-cdk-lib';
|
|
2
|
-
|
|
3
|
-
export interface QpqResource {
|
|
4
|
-
/**
|
|
5
|
-
* Grants read permissions on this resource.
|
|
6
|
-
*
|
|
7
|
-
* @param grantee the role to be granted read-only access to the resource.
|
|
8
|
-
*/
|
|
9
|
-
grantRead(grantee: aws_iam.IGrantable): void;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Grants write permissions on the resource.
|
|
13
|
-
*
|
|
14
|
-
* @param grantee the role to be granted write access to the resource.
|
|
15
|
-
*/
|
|
16
|
-
grantWrite(grantee: aws_iam.IGrantable): void;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Grants read/write permissions on the resource.
|
|
20
|
-
*
|
|
21
|
-
* @param grantee the role to be granted read/write access to the resource.
|
|
22
|
-
*/
|
|
23
|
-
grantAll(grantee: aws_iam.IGrantable): void;
|
|
24
|
-
}
|
|
1
|
+
import { aws_iam } from 'aws-cdk-lib';
|
|
2
|
+
|
|
3
|
+
export interface QpqResource {
|
|
4
|
+
/**
|
|
5
|
+
* Grants read permissions on this resource.
|
|
6
|
+
*
|
|
7
|
+
* @param grantee the role to be granted read-only access to the resource.
|
|
8
|
+
*/
|
|
9
|
+
grantRead(grantee: aws_iam.IGrantable): void;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Grants write permissions on the resource.
|
|
13
|
+
*
|
|
14
|
+
* @param grantee the role to be granted write access to the resource.
|
|
15
|
+
*/
|
|
16
|
+
grantWrite(grantee: aws_iam.IGrantable): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Grants read/write permissions on the resource.
|
|
20
|
+
*
|
|
21
|
+
* @param grantee the role to be granted read/write access to the resource.
|
|
22
|
+
*/
|
|
23
|
+
grantAll(grantee: aws_iam.IGrantable): void;
|
|
24
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './QpqConstructBlock';
|
|
2
|
-
export * from './QpqResource';
|
|
1
|
+
export * from './QpqConstructBlock';
|
|
2
|
+
export * from './QpqResource';
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { aws_events, aws_sns, aws_events_targets } from 'aws-cdk-lib';
|
|
2
|
-
|
|
3
|
-
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
4
|
-
import { Construct } from 'constructs';
|
|
5
|
-
|
|
6
|
-
import { BootstrapResource } from '../../constants';
|
|
7
|
-
|
|
8
|
-
export interface BSQpqLambdaWarmerEventConstructConstructProps extends QpqConstructBlockProps {}
|
|
9
|
-
|
|
10
|
-
export class BSQpqLambdaWarmerEventConstructConstruct extends QpqConstructBlock {
|
|
11
|
-
constructor(scope: Construct, id: string, props: BSQpqLambdaWarmerEventConstructConstructProps) {
|
|
12
|
-
super(scope, id, props);
|
|
13
|
-
|
|
14
|
-
const rule = new aws_events.Rule(this, 'WarmLambdaRule', {
|
|
15
|
-
ruleName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
16
|
-
// Create an EventBridge rule to trigger the Lambda every X minutes
|
|
17
|
-
schedule: aws_events.Schedule.expression('rate(5 minutes)'),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const topic = new aws_sns.Topic(this, 'MyTopic', {
|
|
21
|
-
topicName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
22
|
-
displayName: 'Warm Lambdas',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
rule.addTarget(
|
|
26
|
-
new aws_events_targets.SnsTopic(topic, {
|
|
27
|
-
message: aws_events.RuleTargetInput.fromObject({
|
|
28
|
-
type: 'QpqLambdaWarmerEvent',
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { aws_events, aws_sns, aws_events_targets } from 'aws-cdk-lib';
|
|
2
|
+
|
|
3
|
+
import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructBlock';
|
|
4
|
+
import { Construct } from 'constructs';
|
|
5
|
+
|
|
6
|
+
import { BootstrapResource } from '../../constants';
|
|
7
|
+
|
|
8
|
+
export interface BSQpqLambdaWarmerEventConstructConstructProps extends QpqConstructBlockProps {}
|
|
9
|
+
|
|
10
|
+
export class BSQpqLambdaWarmerEventConstructConstruct extends QpqConstructBlock {
|
|
11
|
+
constructor(scope: Construct, id: string, props: BSQpqLambdaWarmerEventConstructConstructProps) {
|
|
12
|
+
super(scope, id, props);
|
|
13
|
+
|
|
14
|
+
const rule = new aws_events.Rule(this, 'WarmLambdaRule', {
|
|
15
|
+
ruleName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
16
|
+
// Create an EventBridge rule to trigger the Lambda every X minutes
|
|
17
|
+
schedule: aws_events.Schedule.expression('rate(5 minutes)'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const topic = new aws_sns.Topic(this, 'MyTopic', {
|
|
21
|
+
topicName: this.qpqBootstrapResourceName(BootstrapResource.WarmLambdas),
|
|
22
|
+
displayName: 'Warm Lambdas',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
rule.addTarget(
|
|
26
|
+
new aws_events_targets.SnsTopic(topic, {
|
|
27
|
+
message: aws_events.RuleTargetInput.fromObject({
|
|
28
|
+
type: 'QpqLambdaWarmerEvent',
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|