You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: CONTRIB_FAQ.md
+63-10
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,52 @@ Put relevant type of contribution in the commit message. This message is used to
120
120
* Typedoc (https://typedoc.org/guides/doccomments/) for code comments and API documentation in the framework (./core). See the `ExampleProps` interface and `Example` class [here](https://github.com/aws-samples/aws-analytics-reference-architecture/blob/main/core/src/example.ts)
121
121
* Pdoc3 (https://pdoc3.github.io/pdoc/) for code comments and API documentation of reference architectures (./refarch)
122
122
123
+
Examples can be found in the current code documentation used by [Construct Hub](https://constructs.dev/packages/aws-analytics-reference-architecture). For example here is the code comment for the DataLakeStorage construct:
124
+
125
+
```
126
+
/**
127
+
* A CDK Construct that creates the storage layers of a data lake composed of Amazon S3 Buckets.
128
+
*
129
+
* This construct is based on 3 Amazon S3 buckets configured with AWS best practices:
130
+
* * S3 buckets for Raw/Cleaned/Transformed data,
131
+
* * data lifecycle optimization/transitioning to different Amazon S3 storage classes
132
+
* * server side buckets encryption managed by KMS customer key
133
+
* * Default single KMS key
134
+
* * SSL communication enforcement
135
+
* * access logged to an S3 bucket
136
+
* * All public access blocked
137
+
*
138
+
* By default the transitioning rules to Amazon S3 storage classes are configured as following:
139
+
* * Raw data is moved to Infrequent Access after 30 days and archived to Glacier after 90 days
140
+
* * Clean and Transformed data is moved to Infrequent Access after 90 days and is not archived
141
+
*
142
+
* Objects and buckets are automatically deleted when the CDK application is detroyed.
143
+
*
144
+
* For custom requirements, consider using {@link AraBucket}.
145
+
*
146
+
* Usage example:
147
+
* ```typescript
148
+
* import * as cdk from 'aws-cdk-lib';
149
+
* import { DataLakeStorage } from 'aws-analytics-reference-architecture';
150
+
*
151
+
* const exampleApp = new cdk.App();
152
+
* const stack = new cdk.Stack(exampleApp, 'DataLakeStorageStack');
153
+
*
154
+
* new DataLakeStorage(stack, 'MyDataLakeStorage', {
155
+
* rawInfrequentAccessDelay: 90,
156
+
* rawArchiveDelay: 180,
157
+
* cleanInfrequentAccessDelay: 180,
158
+
* cleanArchiveDelay: 360,
159
+
* transformInfrequentAccessDelay: 180,
160
+
* transformArchiveDelay: 360,
161
+
* });
162
+
* ```
163
+
*/
164
+
```
165
+
166
+
And [how it renders in Construct Hub](https://constructs.dev/packages/aws-analytics-reference-architecture/v/2.1.0/api/DataLakeStorage?lang=python).
167
+
168
+
123
169
## CDK best practices
124
170
125
171
### What are the coding best practices and patterns with CDK
@@ -267,13 +313,18 @@ Thus, we choose to prebundle Lambda function by installing all dependencies on p
267
313
268
314
## Testing
269
315
270
-
#### How to test CDK Constructs logic with a deployment in AWS Account?
316
+
###What are the required tests to implement?
271
317
272
-
AWS CDK logic can be tested by deploying a stack that instantiates AWS CDK components. Projen is configured to provide extra actions `test:deploy` and `test:destroy` to deploy in a testing account and destroy. [`./core/src/integ.default.ts`](./core/src/integ.default.ts) can be customized to deploy Constructs.
318
+
It's required to implement 3 types of test:
319
+
* Unit tests (in `core/test/unit`): validate the CloudFormation that is generated by CDK
320
+
* CDK-nag tests (in `core/test/unit/cdk-nag`): validate the CDK resources with [CDK-nag](https://github.com/cdklabs/cdk-nag) and the [AWS Solutions rule pack](https://github.com/cdklabs/cdk-nag/blob/main/RULES.md#awssolutions)
321
+
* End-to-end tests (in `core/test/e2e`): validate the CDK resources can be deployed in an account, and the resources are running as expected. **It's strongly recommended to test the deployment of 2 resources to validate the unicity of CDK IDs and resource names**
273
322
274
-
### How to test private class members or methods in Typescript?
323
+
### How to test CDK Constructs logic with a deployment in AWS Account?
324
+
325
+
AWS CDK logic can be tested by deploying a stack that instantiates AWS CDK components. Projen is configured to provide extra actions `test:deploy` and `test:destroy` to deploy in a testing account and destroy. [`./core/src/integ.default.ts`](./core/src/integ.default.ts) can be customized to deploy Constructs.
275
326
276
-
Typescript allows to access private members and methods using this syntax `customDataset["sqlTable"]()`. See example of testing `sqlTable()`private method from `Dataset` class [here](./core/test/dataset.test.ts)
327
+
Remember to not commit any personal information like account IDs and role name in this file.
277
328
278
329
### How to test the core components library in local
279
330
@@ -283,12 +334,14 @@ Typescript allows to access private members and methods using this syntax `custo
283
334
npx projen package
284
335
```
285
336
286
-
* For Python, create a new AWS CDK application in Python outside of this project and install a local dependency pointing to the `wheel` file in `core/dist/python`. In the `setup.py`, modify the dependencies like this
337
+
* For Python, create a new AWS CDK application in Python outside of this project and install a local dependency pointing to the `wheel` file in `core/dist/python`. In the `requirements.txt`, modify the dependencies like this
### How to test private class members or methods in Typescript?
294
346
347
+
Typescript allows to access private members and methods using this syntax `customDataset["sqlTable"]()`. See example of testing `sqlTable()`private method from `Dataset` class [here](./core/test/dataset.test.ts)
0 commit comments