@flipboxlabs/aws-audit-cdk 1.1.1 → 1.1.2
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 +91 -8
- package/dist/audit-config.d.ts +11 -10
- package/dist/audit-config.d.ts.map +1 -1
- package/dist/audit-config.js +9 -8
- package/dist/cloudwatch/construct.d.ts +6 -0
- package/dist/cloudwatch/construct.d.ts.map +1 -1
- package/dist/cloudwatch/construct.js +9 -8
- package/dist/index.d.ts +2 -43
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -43
- package/dist/lambda/audit-config-layer.d.ts +40 -0
- package/dist/lambda/audit-config-layer.d.ts.map +1 -0
- package/dist/lambda/audit-config-layer.js +50 -0
- package/dist/lambda/construct.d.ts +7 -0
- package/dist/lambda/construct.d.ts.map +1 -0
- package/dist/lambda/construct.js +6 -0
- package/dist/lambda/nodejs.function.d.ts +16 -0
- package/dist/lambda/nodejs.function.d.ts.map +1 -0
- package/dist/{lib → lambda}/nodejs.function.js +14 -1
- package/dist/rest-api/construct.d.ts +6 -0
- package/dist/rest-api/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/app/construct.d.ts +6 -0
- package/dist/rest-api/resources/app/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/app/construct.js +1 -0
- package/dist/rest-api/resources/app/resources/objects/construct.d.ts +6 -0
- package/dist/rest-api/resources/app/resources/objects/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/app/resources/objects/construct.js +7 -5
- package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.d.ts +6 -0
- package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.js +7 -6
- package/dist/rest-api/resources/construct.d.ts +6 -0
- package/dist/rest-api/resources/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/trace/construct.d.ts +6 -0
- package/dist/rest-api/resources/trace/construct.d.ts.map +1 -1
- package/dist/rest-api/resources/trace/construct.js +6 -5
- package/package.json +4 -4
- package/dist/lib/index.d.ts +0 -53
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -52
- package/dist/lib/nodejs.function.d.ts +0 -6
- package/dist/lib/nodejs.function.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -13,18 +13,101 @@ pnpm add @flipboxlabs/aws-audit-cdk
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
16
|
+
import * as cdk from "aws-cdk-lib";
|
|
17
|
+
import type { Construct } from "constructs";
|
|
18
|
+
import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
19
|
+
import { AuditConfigLayer } from "@flipboxlabs/aws-audit-cdk/lambda";
|
|
20
|
+
import { CloudWatchConstruct as CloudWatch } from "@flipboxlabs/aws-audit-cdk/cloudwatch";
|
|
21
|
+
import { DynamoDBConstruct as DynamoDB } from "@flipboxlabs/aws-audit-cdk/dynamodb";
|
|
22
|
+
import { EventBridgeConstruct as EventBridge } from "@flipboxlabs/aws-audit-cdk/eventbridge";
|
|
23
|
+
import { RestApiConstruct as RestAPI } from "@flipboxlabs/aws-audit-cdk/rest-api";
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
config: CDKConfig;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class AuditStack extends cdk.NestedStack {
|
|
30
|
+
constructor(scope: Construct, id: string, props: Props) {
|
|
31
|
+
super(scope, id, { description: "Audit" });
|
|
32
|
+
|
|
33
|
+
// Create audit config layer with your apps and resource types
|
|
34
|
+
const auditConfigLayer = new AuditConfigLayer(this, "AuditConfigLayer", {
|
|
35
|
+
apps: ["Orders", "Inventory"],
|
|
36
|
+
resourceTypes: ["Order", "Product"],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// DynamoDB (storage)
|
|
40
|
+
const { table } = new DynamoDB(this, "DynamoDB", { config: props.config });
|
|
41
|
+
|
|
42
|
+
// EventBridge (events)
|
|
43
|
+
const { eventBus } = new EventBridge(this, "EventBridge", {
|
|
44
|
+
config: props.config,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// CloudWatch (logging subscription)
|
|
48
|
+
new CloudWatch(this, "CloudWatch", {
|
|
49
|
+
config: props.config,
|
|
50
|
+
lambda: { layers: [auditConfigLayer.layer] },
|
|
51
|
+
table,
|
|
52
|
+
eventBus,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// REST API (optional)
|
|
56
|
+
new RestAPI(this, "RestAPI", {
|
|
57
|
+
config: props.config,
|
|
58
|
+
lambda: { layers: [auditConfigLayer.layer] },
|
|
59
|
+
table,
|
|
60
|
+
eventBus,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
20
64
|
```
|
|
21
65
|
|
|
22
66
|
## Constructs
|
|
23
67
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
68
|
+
### AuditConfigLayer
|
|
69
|
+
|
|
70
|
+
Creates a Lambda layer containing your audit configuration (apps and resource types). This layer is required by all other constructs.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { AuditConfigLayer } from "@flipboxlabs/aws-audit-cdk/lambda";
|
|
74
|
+
|
|
75
|
+
const auditConfigLayer = new AuditConfigLayer(this, "AuditConfigLayer", {
|
|
76
|
+
apps: ["Orders", "Inventory"],
|
|
77
|
+
resourceTypes: ["Order", "Product"],
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### CloudWatchConstruct
|
|
82
|
+
|
|
83
|
+
CloudWatch log subscription that captures audit logs and stores them in DynamoDB.
|
|
84
|
+
|
|
85
|
+
### DynamoDBConstruct
|
|
86
|
+
|
|
87
|
+
DynamoDB table for audit storage with optimized indexes for querying by app, resource, and trace.
|
|
88
|
+
|
|
89
|
+
### EventBridgeConstruct
|
|
90
|
+
|
|
91
|
+
EventBridge bus for audit events, enabling event-driven architectures.
|
|
92
|
+
|
|
93
|
+
### RestApiConstruct
|
|
94
|
+
|
|
95
|
+
REST API for querying audits by resource or trace ID.
|
|
96
|
+
|
|
97
|
+
## CDKConfig
|
|
98
|
+
|
|
99
|
+
The `CDKConfig` type defines the configuration passed to constructs:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
type CDKConfig = {
|
|
103
|
+
env: string; // Environment name (e.g., "prod", "staging")
|
|
104
|
+
aws: {
|
|
105
|
+
account: string; // AWS account ID
|
|
106
|
+
region: string; // AWS region
|
|
107
|
+
};
|
|
108
|
+
service?: string; // Optional service name
|
|
109
|
+
};
|
|
110
|
+
```
|
|
28
111
|
|
|
29
112
|
## Peer Dependencies
|
|
30
113
|
|
package/dist/audit-config.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Audit configuration loaded from the Lambda layer.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* This
|
|
6
|
-
*
|
|
7
|
-
* - Zod schemas for validation via `auditConfig.schemas`
|
|
4
|
+
* The `apps` and `resourceTypes` arrays are provided by the AuditConfigLayer
|
|
5
|
+
* construct at deploy time. This file creates the typed configuration object
|
|
6
|
+
* that handlers use.
|
|
8
7
|
*
|
|
9
8
|
* @example
|
|
10
9
|
* ```typescript
|
|
11
|
-
* import { auditConfig } from '../../audit-config.js';
|
|
10
|
+
* import { auditConfig, type App, type ResourceType } from '../../audit-config.js';
|
|
12
11
|
*
|
|
13
12
|
* // Use in handlers
|
|
14
13
|
* const service = new AuditService(logger, auditConfig);
|
|
@@ -23,8 +22,8 @@
|
|
|
23
22
|
export declare const auditConfig: {
|
|
24
23
|
service: string | undefined;
|
|
25
24
|
} & {
|
|
26
|
-
readonly apps: readonly [];
|
|
27
|
-
readonly resourceTypes: readonly [];
|
|
25
|
+
readonly apps: readonly string[];
|
|
26
|
+
readonly resourceTypes: readonly string[];
|
|
28
27
|
} & {
|
|
29
28
|
schemas: {
|
|
30
29
|
app: import("zod").ZodEnum<{
|
|
@@ -44,16 +43,18 @@ export declare const auditConfig: {
|
|
|
44
43
|
}, import("zod/v4/core").$strip>;
|
|
45
44
|
};
|
|
46
45
|
_types: {
|
|
47
|
-
App:
|
|
48
|
-
ResourceType:
|
|
46
|
+
App: string;
|
|
47
|
+
ResourceType: string;
|
|
49
48
|
};
|
|
50
49
|
};
|
|
51
50
|
/**
|
|
52
51
|
* Type alias for the App union type from the audit config.
|
|
52
|
+
* Note: At compile time this is `string` since the actual values come from the layer.
|
|
53
53
|
*/
|
|
54
54
|
export type App = (typeof auditConfig)["_types"]["App"];
|
|
55
55
|
/**
|
|
56
56
|
* Type alias for the ResourceType union type from the audit config.
|
|
57
|
+
* Note: At compile time this is `string` since the actual values come from the layer.
|
|
57
58
|
*/
|
|
58
59
|
export type ResourceType = (typeof auditConfig)["_types"]["ResourceType"];
|
|
59
60
|
//# sourceMappingURL=audit-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-config.d.ts","sourceRoot":"","sources":["../src/audit-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit-config.d.ts","sourceRoot":"","sources":["../src/audit-config.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW;;;mBACT,SAAS,MAAM,EAAE;4BACC,SAAS,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAChD,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC"}
|
package/dist/audit-config.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { defineAuditConfig } from "@flipboxlabs/aws-audit-sdk";
|
|
2
|
+
// @ts-expect-error - This import is resolved at runtime from the Lambda layer
|
|
3
|
+
import { apps, resourceTypes } from "/opt/nodejs/audit-config.js";
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
5
|
+
* Audit configuration loaded from the Lambda layer.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
* This
|
|
7
|
-
*
|
|
8
|
-
* - Zod schemas for validation via `auditConfig.schemas`
|
|
7
|
+
* The `apps` and `resourceTypes` arrays are provided by the AuditConfigLayer
|
|
8
|
+
* construct at deploy time. This file creates the typed configuration object
|
|
9
|
+
* that handlers use.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```typescript
|
|
12
|
-
* import { auditConfig } from '../../audit-config.js';
|
|
13
|
+
* import { auditConfig, type App, type ResourceType } from '../../audit-config.js';
|
|
13
14
|
*
|
|
14
15
|
* // Use in handlers
|
|
15
16
|
* const service = new AuditService(logger, auditConfig);
|
|
@@ -22,6 +23,6 @@ import { defineAuditConfig } from "@flipboxlabs/aws-audit-sdk";
|
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
25
|
export const auditConfig = defineAuditConfig({
|
|
25
|
-
apps:
|
|
26
|
-
resourceTypes:
|
|
26
|
+
apps: apps,
|
|
27
|
+
resourceTypes: resourceTypes,
|
|
27
28
|
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
2
2
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
3
3
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
4
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
4
5
|
import { Construct } from "constructs";
|
|
5
6
|
type Props = {
|
|
6
7
|
config: CDKConfig;
|
|
7
8
|
table: dynamodb.ITable;
|
|
8
9
|
eventBus: events.IEventBus;
|
|
10
|
+
/** Lambda configuration */
|
|
11
|
+
lambda: {
|
|
12
|
+
/** Lambda layers to attach to the function */
|
|
13
|
+
layers: lambda.ILayerVersion[];
|
|
14
|
+
};
|
|
9
15
|
subscriptionFilter?: {
|
|
10
16
|
/** Scope of the subscription filter policy. Defaults to "ALL". */
|
|
11
17
|
scope?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../src/cloudwatch/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../src/cloudwatch/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IAEF,kBAAkB,CAAC,EAAE;QACpB,kEAAkE;QAClE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,oGAAoG;QACpG,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;CACF,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,SAAS;gBACrC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAyDtD"}
|
|
@@ -3,25 +3,26 @@ import { AUDIT_LOG_IDENTIFIER } from "@flipboxlabs/aws-audit-sdk";
|
|
|
3
3
|
import { ServicePrincipal } from "aws-cdk-lib/aws-iam";
|
|
4
4
|
import * as logs from "aws-cdk-lib/aws-logs";
|
|
5
5
|
import { Construct } from "constructs";
|
|
6
|
-
import { ESMNodeFunctionFactory } from "../
|
|
6
|
+
import { ESMNodeFunctionFactory } from "../lambda/nodejs.function.js";
|
|
7
7
|
export class CloudWatchConstruct extends Construct {
|
|
8
8
|
constructor(scope, id, props) {
|
|
9
9
|
super(scope, id);
|
|
10
10
|
const ref = `${[props.config.env.toUpperCase(), "Account", "CloudWatch", "Subscription"].join("-")}`;
|
|
11
11
|
// Lambda Function
|
|
12
|
-
const
|
|
12
|
+
const lambdaFn = ESMNodeFunctionFactory(props.config)(this, "subscription", {
|
|
13
13
|
functionName: ref,
|
|
14
14
|
entry: url.fileURLToPath(new URL("subscription.handler.ts", import.meta.url).toString()),
|
|
15
|
+
layers: props.lambda.layers,
|
|
15
16
|
currentVersionOptions: {
|
|
16
17
|
retryAttempts: 2,
|
|
17
18
|
},
|
|
18
19
|
});
|
|
19
20
|
// Allow writes to DynamoDB
|
|
20
|
-
props.table.grantWriteData(
|
|
21
|
+
props.table.grantWriteData(lambdaFn);
|
|
21
22
|
// Allow puts to EventBridge
|
|
22
|
-
props.eventBus.grantPutEventsTo(
|
|
23
|
+
props.eventBus.grantPutEventsTo(lambdaFn);
|
|
23
24
|
// Permissions
|
|
24
|
-
|
|
25
|
+
lambdaFn.addPermission("LogProcessorPermission", {
|
|
25
26
|
principal: new ServicePrincipal("logs.amazonaws.com"),
|
|
26
27
|
action: "lambda:InvokeFunction",
|
|
27
28
|
sourceArn: `arn:aws:logs:${props.config.aws.region}:${props.config.aws.account}:log-group:*`,
|
|
@@ -32,15 +33,15 @@ export class CloudWatchConstruct extends Construct {
|
|
|
32
33
|
policyName: `${props.config.env.toUpperCase()}AccountLevelSubscriptionPolicy`,
|
|
33
34
|
policyType: "SUBSCRIPTION_FILTER_POLICY",
|
|
34
35
|
policyDocument: JSON.stringify({
|
|
35
|
-
DestinationArn:
|
|
36
|
+
DestinationArn: lambdaFn.functionArn,
|
|
36
37
|
Distribution: "Random",
|
|
37
38
|
FilterPattern: `{ $.${AUDIT_LOG_IDENTIFIER}.operation = * }`,
|
|
38
39
|
}),
|
|
39
40
|
scope: props.subscriptionFilter?.scope ?? "ALL",
|
|
40
41
|
selectionCriteria: props.subscriptionFilter?.selectionCriteria ??
|
|
41
|
-
`LogGroupName NOT IN ["/aws/lambda/${
|
|
42
|
+
`LogGroupName NOT IN ["/aws/lambda/${lambdaFn.functionName}"]`,
|
|
42
43
|
});
|
|
43
44
|
// Add explicit dependency on the Lambda function
|
|
44
|
-
accountPolicy.node.addDependency(
|
|
45
|
+
accountPolicy.node.addDependency(lambdaFn);
|
|
45
46
|
}
|
|
46
47
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,50 +4,9 @@
|
|
|
4
4
|
* Provides constructs for deploying audit infrastructure. Import and compose
|
|
5
5
|
* the constructs in your own stack as needed.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import * as cdk from "aws-cdk-lib";
|
|
10
|
-
* import type { Construct } from "constructs";
|
|
11
|
-
* import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
7
|
+
* See the README for full usage examples.
|
|
12
8
|
*
|
|
13
|
-
*
|
|
14
|
-
* import { CloudWatchConstruct as CloudWatch } from "@flipboxlabs/aws-audit-cdk/cloudwatch";
|
|
15
|
-
* import { DynamoDBConstruct as DynamoDB } from "@flipboxlabs/aws-audit-cdk/dynamodb";
|
|
16
|
-
* import { EventBridgeConstruct as EventBridge } from "@flipboxlabs/aws-audit-cdk/eventbridge";
|
|
17
|
-
* import { RestApiConstruct as RestAPI } from "@flipboxlabs/aws-audit-cdk/rest-api";
|
|
18
|
-
*
|
|
19
|
-
* interface Props {
|
|
20
|
-
* config: CDKConfig;
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* export class AuditStack extends cdk.NestedStack {
|
|
24
|
-
* constructor(scope: Construct, id: string, props: Props) {
|
|
25
|
-
* super(scope, id, { description: "Audit" });
|
|
26
|
-
*
|
|
27
|
-
* // DynamoDB (storage)
|
|
28
|
-
* const { table } = new DynamoDB(this, "DynamoDB", { config: props.config });
|
|
29
|
-
*
|
|
30
|
-
* // EventBridge (events)
|
|
31
|
-
* const { eventBus } = new EventBridge(this, "EventBridge", {
|
|
32
|
-
* config: props.config,
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // CloudWatch (logging subscription)
|
|
36
|
-
* new CloudWatch(this, "CloudWatch", {
|
|
37
|
-
* config: props.config,
|
|
38
|
-
* table,
|
|
39
|
-
* eventBus,
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // REST API (optional)
|
|
43
|
-
* new RestAPI(this, "RestAPI", {
|
|
44
|
-
* config: props.config,
|
|
45
|
-
* table,
|
|
46
|
-
* eventBus,
|
|
47
|
-
* });
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
9
|
+
* @packageDocumentation
|
|
51
10
|
*/
|
|
52
11
|
export * from "./constants.js";
|
|
53
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,49 +4,8 @@
|
|
|
4
4
|
* Provides constructs for deploying audit infrastructure. Import and compose
|
|
5
5
|
* the constructs in your own stack as needed.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import * as cdk from "aws-cdk-lib";
|
|
10
|
-
* import type { Construct } from "constructs";
|
|
11
|
-
* import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
7
|
+
* See the README for full usage examples.
|
|
12
8
|
*
|
|
13
|
-
*
|
|
14
|
-
* import { CloudWatchConstruct as CloudWatch } from "@flipboxlabs/aws-audit-cdk/cloudwatch";
|
|
15
|
-
* import { DynamoDBConstruct as DynamoDB } from "@flipboxlabs/aws-audit-cdk/dynamodb";
|
|
16
|
-
* import { EventBridgeConstruct as EventBridge } from "@flipboxlabs/aws-audit-cdk/eventbridge";
|
|
17
|
-
* import { RestApiConstruct as RestAPI } from "@flipboxlabs/aws-audit-cdk/rest-api";
|
|
18
|
-
*
|
|
19
|
-
* interface Props {
|
|
20
|
-
* config: CDKConfig;
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* export class AuditStack extends cdk.NestedStack {
|
|
24
|
-
* constructor(scope: Construct, id: string, props: Props) {
|
|
25
|
-
* super(scope, id, { description: "Audit" });
|
|
26
|
-
*
|
|
27
|
-
* // DynamoDB (storage)
|
|
28
|
-
* const { table } = new DynamoDB(this, "DynamoDB", { config: props.config });
|
|
29
|
-
*
|
|
30
|
-
* // EventBridge (events)
|
|
31
|
-
* const { eventBus } = new EventBridge(this, "EventBridge", {
|
|
32
|
-
* config: props.config,
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // CloudWatch (logging subscription)
|
|
36
|
-
* new CloudWatch(this, "CloudWatch", {
|
|
37
|
-
* config: props.config,
|
|
38
|
-
* table,
|
|
39
|
-
* eventBus,
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // REST API (optional)
|
|
43
|
-
* new RestAPI(this, "RestAPI", {
|
|
44
|
-
* config: props.config,
|
|
45
|
-
* table,
|
|
46
|
-
* eventBus,
|
|
47
|
-
* });
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
9
|
+
* @packageDocumentation
|
|
51
10
|
*/
|
|
52
11
|
export * from "./constants.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
/**
|
|
4
|
+
* Input configuration for the audit config layer.
|
|
5
|
+
* Contains the apps and resource types that will be available to Lambda handlers.
|
|
6
|
+
*/
|
|
7
|
+
export interface AuditConfigLayerProps {
|
|
8
|
+
/** List of valid application identifiers */
|
|
9
|
+
readonly apps: readonly string[];
|
|
10
|
+
/** List of valid resource type identifiers */
|
|
11
|
+
readonly resourceTypes: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Path where handlers should import the audit config from.
|
|
15
|
+
* This is the standard Lambda layer path for Node.js.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AUDIT_CONFIG_LAYER_PATH = "/opt/nodejs/audit-config.js";
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Lambda layer containing the audit configuration.
|
|
20
|
+
*
|
|
21
|
+
* The layer exports raw `apps` and `resourceTypes` arrays that handlers
|
|
22
|
+
* can use with `defineAuditConfig` from the SDK.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { AuditConfigLayer } from "@flipboxlabs/aws-audit-cdk";
|
|
27
|
+
*
|
|
28
|
+
* const auditLayer = new AuditConfigLayer(this, "AuditConfigLayer", {
|
|
29
|
+
* apps: ["Orders", "Inventory"],
|
|
30
|
+
* resourceTypes: ["Order", "Product"],
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Pass auditLayer.layer to constructs that need it
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class AuditConfigLayer extends Construct {
|
|
37
|
+
readonly layer: lambda.LayerVersion;
|
|
38
|
+
constructor(scope: Construct, id: string, props: AuditConfigLayerProps);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=audit-config-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-config-layer.d.ts","sourceRoot":"","sources":["../../src/lambda/audit-config-layer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,SAAgB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;gBAE/B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB;CAuBtE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
|
+
import { Construct } from "constructs";
|
|
6
|
+
/**
|
|
7
|
+
* Path where handlers should import the audit config from.
|
|
8
|
+
* This is the standard Lambda layer path for Node.js.
|
|
9
|
+
*/
|
|
10
|
+
export const AUDIT_CONFIG_LAYER_PATH = "/opt/nodejs/audit-config.js";
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Lambda layer containing the audit configuration.
|
|
13
|
+
*
|
|
14
|
+
* The layer exports raw `apps` and `resourceTypes` arrays that handlers
|
|
15
|
+
* can use with `defineAuditConfig` from the SDK.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { AuditConfigLayer } from "@flipboxlabs/aws-audit-cdk";
|
|
20
|
+
*
|
|
21
|
+
* const auditLayer = new AuditConfigLayer(this, "AuditConfigLayer", {
|
|
22
|
+
* apps: ["Orders", "Inventory"],
|
|
23
|
+
* resourceTypes: ["Order", "Product"],
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Pass auditLayer.layer to constructs that need it
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export class AuditConfigLayer extends Construct {
|
|
30
|
+
layer;
|
|
31
|
+
constructor(scope, id, props) {
|
|
32
|
+
super(scope, id);
|
|
33
|
+
// Generate config file content - exports raw data
|
|
34
|
+
// Handlers will call defineAuditConfig themselves
|
|
35
|
+
const configCode = `// Auto-generated audit configuration
|
|
36
|
+
export const apps = ${JSON.stringify(props.apps)};
|
|
37
|
+
export const resourceTypes = ${JSON.stringify(props.resourceTypes)};
|
|
38
|
+
`;
|
|
39
|
+
// Create temp directory with proper layer structure
|
|
40
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "audit-config-"));
|
|
41
|
+
const nodejsDir = path.join(tempDir, "nodejs");
|
|
42
|
+
fs.mkdirSync(nodejsDir);
|
|
43
|
+
fs.writeFileSync(path.join(nodejsDir, "audit-config.js"), configCode);
|
|
44
|
+
this.layer = new lambda.LayerVersion(this, "Layer", {
|
|
45
|
+
code: lambda.Code.fromAsset(tempDir),
|
|
46
|
+
compatibleRuntimes: [lambda.Runtime.NODEJS_20_X],
|
|
47
|
+
description: "Audit configuration layer containing apps and resourceTypes",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../src/lambda/construct.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as cdk from "aws-cdk-lib";
|
|
2
|
+
import * as nodejs from "aws-cdk-lib/aws-lambda-nodejs";
|
|
3
|
+
import type { Construct } from "constructs";
|
|
4
|
+
import type { CDKConfig } from "../constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* Factory function that creates ESM Node.js Lambda functions with standard configuration.
|
|
7
|
+
*
|
|
8
|
+
* The audit config layer should be passed via the `layers` prop in NodejsFunctionProps.
|
|
9
|
+
*
|
|
10
|
+
* @param config - CDK configuration for environment variables
|
|
11
|
+
* @returns A function that creates configured NodejsFunction instances
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const ESMNodeFunctionFactory: (config: CDKConfig) => (scope: Construct, id: string, props: nodejs.NodejsFunctionProps) => cdk.aws_lambda_nodejs.NodejsFunction;
|
|
16
|
+
//# sourceMappingURL=nodejs.function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodejs.function.d.ts","sourceRoot":"","sources":["../../src/lambda/nodejs.function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,MACjB,OAAO,SAAS,EAAE,IAAI,MAAM,EAAE,OAAO,MAAM,CAAC,mBAAmB,yCA2D/D,CAAC"}
|
|
@@ -3,6 +3,17 @@ import * as iam from "aws-cdk-lib/aws-iam";
|
|
|
3
3
|
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
4
4
|
import * as nodejs from "aws-cdk-lib/aws-lambda-nodejs";
|
|
5
5
|
import * as logs from "aws-cdk-lib/aws-logs";
|
|
6
|
+
import { AUDIT_CONFIG_LAYER_PATH } from "./audit-config-layer.js";
|
|
7
|
+
/**
|
|
8
|
+
* Factory function that creates ESM Node.js Lambda functions with standard configuration.
|
|
9
|
+
*
|
|
10
|
+
* The audit config layer should be passed via the `layers` prop in NodejsFunctionProps.
|
|
11
|
+
*
|
|
12
|
+
* @param config - CDK configuration for environment variables
|
|
13
|
+
* @returns A function that creates configured NodejsFunction instances
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
6
17
|
export const ESMNodeFunctionFactory = (config) => (scope, id, props) => {
|
|
7
18
|
const nodejsFunction = new nodejs.NodejsFunction(scope, id, {
|
|
8
19
|
tracing: lambda.Tracing.ACTIVE,
|
|
@@ -14,7 +25,8 @@ export const ESMNodeFunctionFactory = (config) => (scope, id, props) => {
|
|
|
14
25
|
bundling: {
|
|
15
26
|
minify: true,
|
|
16
27
|
metafile: false,
|
|
17
|
-
|
|
28
|
+
// Mark audit config layer path as external so esbuild doesn't try to bundle it
|
|
29
|
+
externalModules: ["aws-sdk", "@aws-sdk/*", AUDIT_CONFIG_LAYER_PATH],
|
|
18
30
|
format: nodejs.OutputFormat.ESM,
|
|
19
31
|
platform: "node",
|
|
20
32
|
target: "esnext",
|
|
@@ -43,6 +55,7 @@ export const ESMNodeFunctionFactory = (config) => (scope, id, props) => {
|
|
|
43
55
|
if (config.service) {
|
|
44
56
|
nodejsFunction.addEnvironment("SERVICE", config.service);
|
|
45
57
|
}
|
|
58
|
+
// Add Lambda Insights layer
|
|
46
59
|
nodejsFunction.addLayers(lambda.LayerVersion.fromLayerVersionArn(scope, `${id}InsightLayer`, `arn:aws:lambda:${cdk.Stack.of(scope).region}:580247275435:layer:LambdaInsightsExtension-Arm64:2`));
|
|
47
60
|
return nodejsFunction;
|
|
48
61
|
};
|
|
@@ -2,11 +2,17 @@ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
4
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
5
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { Construct } from "constructs";
|
|
6
7
|
type Props = {
|
|
7
8
|
config: CDKConfig;
|
|
8
9
|
table: dynamodb.ITable;
|
|
9
10
|
eventBus: events.IEventBus;
|
|
11
|
+
/** Lambda configuration */
|
|
12
|
+
lambda: {
|
|
13
|
+
/** Lambda layers to attach to the function */
|
|
14
|
+
layers: lambda.ILayerVersion[];
|
|
15
|
+
};
|
|
10
16
|
/** Override REST API props. */
|
|
11
17
|
restApi?: Partial<apigateway.RestApiProps>;
|
|
12
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../src/rest-api/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,+BAA+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAIF,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,SAAgB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;gBAEhC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA6BtD"}
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../src/rest-api/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,+BAA+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAIF,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,SAAgB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;gBAEhC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA6BtD"}
|
|
@@ -2,11 +2,17 @@ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
|
2
2
|
import type * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
4
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
5
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { Construct } from "constructs";
|
|
6
7
|
type Props = {
|
|
7
8
|
config: CDKConfig;
|
|
8
9
|
table: dynamodb.ITable;
|
|
9
10
|
eventBus: events.IEventBus;
|
|
11
|
+
/** Lambda configuration */
|
|
12
|
+
lambda: {
|
|
13
|
+
/** Lambda layers to attach to the function */
|
|
14
|
+
layers: lambda.ILayerVersion[];
|
|
15
|
+
};
|
|
10
16
|
restApi: {
|
|
11
17
|
resource: apigateway.IResource;
|
|
12
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/app/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/app/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAetD"}
|
|
@@ -2,11 +2,17 @@ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
4
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
5
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { Construct } from "constructs";
|
|
6
7
|
type Props = {
|
|
7
8
|
config: CDKConfig;
|
|
8
9
|
table: dynamodb.ITable;
|
|
9
10
|
eventBus: events.IEventBus;
|
|
11
|
+
/** Lambda configuration */
|
|
12
|
+
lambda: {
|
|
13
|
+
/** Lambda layers to attach to the function */
|
|
14
|
+
layers: lambda.ILayerVersion[];
|
|
15
|
+
};
|
|
10
16
|
restApi: {
|
|
11
17
|
resource: apigateway.IResource;
|
|
12
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA6DtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as url from "node:url";
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
|
-
import { ESMNodeFunctionFactory } from "../../../../../
|
|
4
|
+
import { ESMNodeFunctionFactory } from "../../../../../lambda/nodejs.function.js";
|
|
5
5
|
import { API_RESOURCE } from "./constants.js";
|
|
6
6
|
import ReRun from "./resources/rerun/construct.js";
|
|
7
7
|
export default class extends Construct {
|
|
@@ -14,19 +14,20 @@ export default class extends Construct {
|
|
|
14
14
|
"Resources",
|
|
15
15
|
].join("-");
|
|
16
16
|
// Lambda
|
|
17
|
-
const
|
|
17
|
+
const lambdaFn = ESMNodeFunctionFactory(props.config)(this, "NodeFunction", {
|
|
18
18
|
functionName: ref,
|
|
19
19
|
entry: url.fileURLToPath(new URL("handler.ts", import.meta.url).toString()),
|
|
20
|
+
layers: props.lambda.layers,
|
|
20
21
|
currentVersionOptions: {
|
|
21
22
|
retryAttempts: 1,
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
// Logger / Metrics / Tracing
|
|
25
|
-
|
|
26
|
+
lambdaFn.addEnvironment("POWERTOOLS_SERVICE_NAME", "Resource");
|
|
26
27
|
// Audit
|
|
27
|
-
props.table.grantReadWriteData(
|
|
28
|
+
props.table.grantReadWriteData(lambdaFn);
|
|
28
29
|
// Integration
|
|
29
|
-
const integration = new apigateway.LambdaIntegration(
|
|
30
|
+
const integration = new apigateway.LambdaIntegration(lambdaFn);
|
|
30
31
|
const RESOURCE = props.restApi.resource
|
|
31
32
|
.addResource(API_RESOURCE.RESOURCE)
|
|
32
33
|
.addResource(`{${API_RESOURCE.RESOURCE_WILDCARD}}`);
|
|
@@ -40,6 +41,7 @@ export default class extends Construct {
|
|
|
40
41
|
config: props.config,
|
|
41
42
|
table: props.table,
|
|
42
43
|
eventBus: props.eventBus,
|
|
44
|
+
lambda: props.lambda,
|
|
43
45
|
restApi: {
|
|
44
46
|
resource: ITEM_RESOURCE.addResource(`{${API_RESOURCE.RESOURCE_WILDCARD_ITEM_AUDIT}}`),
|
|
45
47
|
},
|
|
@@ -2,11 +2,17 @@ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
4
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
5
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { Construct } from "constructs";
|
|
6
7
|
type Props = {
|
|
7
8
|
config: CDKConfig;
|
|
8
9
|
table: dynamodb.ITable;
|
|
9
10
|
eventBus: events.IEventBus;
|
|
11
|
+
/** Lambda configuration */
|
|
12
|
+
lambda: {
|
|
13
|
+
/** Lambda layers to attach to the function */
|
|
14
|
+
layers: lambda.ILayerVersion[];
|
|
15
|
+
};
|
|
10
16
|
restApi: {
|
|
11
17
|
resource: apigateway.IResource;
|
|
12
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../../../src/rest-api/resources/app/resources/objects/resources/rerun/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../../../src/rest-api/resources/app/resources/objects/resources/rerun/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA8CtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as url from "node:url";
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
|
-
import { ESMNodeFunctionFactory } from "../../../../../../../
|
|
4
|
+
import { ESMNodeFunctionFactory } from "../../../../../../../lambda/nodejs.function.js";
|
|
5
5
|
import { API_RESOURCE } from "./constants.js";
|
|
6
6
|
export default class extends Construct {
|
|
7
7
|
constructor(scope, id, props) {
|
|
@@ -13,21 +13,22 @@ export default class extends Construct {
|
|
|
13
13
|
"Resource-Rerun",
|
|
14
14
|
].join("-");
|
|
15
15
|
// Lambda
|
|
16
|
-
const
|
|
16
|
+
const lambdaFn = ESMNodeFunctionFactory(props.config)(this, "NodeFunction", {
|
|
17
17
|
functionName: ref,
|
|
18
18
|
entry: url.fileURLToPath(new URL("handler.ts", import.meta.url).toString()),
|
|
19
|
+
layers: props.lambda.layers,
|
|
19
20
|
currentVersionOptions: {
|
|
20
21
|
retryAttempts: 1,
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
// Logger / Metrics / Tracing
|
|
24
|
-
|
|
25
|
+
lambdaFn.addEnvironment("POWERTOOLS_SERVICE_NAME", "ResourceRerun");
|
|
25
26
|
// Audit
|
|
26
|
-
props.table.grantReadWriteData(
|
|
27
|
+
props.table.grantReadWriteData(lambdaFn);
|
|
27
28
|
// Put events
|
|
28
|
-
props.eventBus.grantPutEventsTo(
|
|
29
|
+
props.eventBus.grantPutEventsTo(lambdaFn);
|
|
29
30
|
// Integration
|
|
30
|
-
const integration = new apigateway.LambdaIntegration(
|
|
31
|
+
const integration = new apigateway.LambdaIntegration(lambdaFn);
|
|
31
32
|
const RESOURCE = props.restApi.resource.addResource(API_RESOURCE.RESOURCE);
|
|
32
33
|
// /apps/{app}/objects/{object}/{item}/{audit}/rerun
|
|
33
34
|
RESOURCE.addMethod("POST", integration, {
|
|
@@ -2,11 +2,17 @@ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
|
2
2
|
import type * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
4
|
import type * as events from "aws-cdk-lib/aws-events";
|
|
5
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { Construct } from "constructs";
|
|
6
7
|
interface Props {
|
|
7
8
|
config: CDKConfig;
|
|
8
9
|
table: dynamodb.ITable;
|
|
9
10
|
eventBus: events.IEventBus;
|
|
11
|
+
/** Lambda configuration */
|
|
12
|
+
lambda: {
|
|
13
|
+
/** Lambda layers to attach to the function */
|
|
14
|
+
layers: lambda.ILayerVersion[];
|
|
15
|
+
};
|
|
10
16
|
restApi: {
|
|
11
17
|
resource: apigateway.IResource;
|
|
12
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/rest-api/resources/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,UAAU,KAAK;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAE/B,CAAC;CACF;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC3C,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAOtD"}
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/rest-api/resources/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,UAAU,KAAK;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAE/B,CAAC;CACF;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC3C,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAOtD"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
4
|
+
import type * as lambda from "aws-cdk-lib/aws-lambda";
|
|
4
5
|
import { Construct } from "constructs";
|
|
5
6
|
type Props = {
|
|
6
7
|
config: CDKConfig;
|
|
7
8
|
table: dynamodb.ITable;
|
|
9
|
+
/** Lambda configuration */
|
|
10
|
+
lambda: {
|
|
11
|
+
/** Lambda layers to attach to the function */
|
|
12
|
+
layers: lambda.ILayerVersion[];
|
|
13
|
+
};
|
|
8
14
|
restApi: {
|
|
9
15
|
resource: apigateway.IResource;
|
|
10
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,2BAA2B;IAC3B,MAAM,EAAE;QACP,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA6CtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as url from "node:url";
|
|
2
2
|
import * as apigateway from "aws-cdk-lib/aws-apigateway";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
|
-
import { ESMNodeFunctionFactory } from "../../../
|
|
4
|
+
import { ESMNodeFunctionFactory } from "../../../lambda/nodejs.function.js";
|
|
5
5
|
import { API_RESOURCE } from "./constants.js";
|
|
6
6
|
export default class extends Construct {
|
|
7
7
|
constructor(scope, id, props) {
|
|
@@ -13,19 +13,20 @@ export default class extends Construct {
|
|
|
13
13
|
"Trace",
|
|
14
14
|
].join("-");
|
|
15
15
|
// Lambda
|
|
16
|
-
const
|
|
16
|
+
const lambdaFn = ESMNodeFunctionFactory(props.config)(this, "NodeFunction", {
|
|
17
17
|
functionName: ref,
|
|
18
18
|
entry: url.fileURLToPath(new URL("handler.ts", import.meta.url).toString()),
|
|
19
|
+
layers: props.lambda.layers,
|
|
19
20
|
currentVersionOptions: {
|
|
20
21
|
retryAttempts: 1,
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
// Logger / Metrics / Tracing
|
|
24
|
-
|
|
25
|
+
lambdaFn.addEnvironment("POWERTOOLS_SERVICE_NAME", "Trace");
|
|
25
26
|
// DynamoDB
|
|
26
|
-
props.table.grantReadWriteData(
|
|
27
|
+
props.table.grantReadWriteData(lambdaFn);
|
|
27
28
|
// Integration
|
|
28
|
-
const integration = new apigateway.LambdaIntegration(
|
|
29
|
+
const integration = new apigateway.LambdaIntegration(lambdaFn);
|
|
29
30
|
const RESOURCE = props.restApi.resource
|
|
30
31
|
.addResource(API_RESOURCE.RESOURCE)
|
|
31
32
|
.addResource(`{${API_RESOURCE.RESOURCE}}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flipboxlabs/aws-audit-cdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "AWS Audit CDK - CDK constructs for AWS audit infrastructure",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"import": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
-
"./
|
|
13
|
-
"types": "./dist/
|
|
14
|
-
"import": "./dist/
|
|
12
|
+
"./lambda": {
|
|
13
|
+
"types": "./dist/lambda/construct.d.ts",
|
|
14
|
+
"import": "./dist/lambda/construct.js"
|
|
15
15
|
},
|
|
16
16
|
"./cloudwatch": {
|
|
17
17
|
"types": "./dist/cloudwatch/construct.d.ts",
|
package/dist/lib/index.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AWS Audit CDK Library
|
|
3
|
-
*
|
|
4
|
-
* Provides constructs for deploying audit infrastructure. Import and compose
|
|
5
|
-
* the constructs in your own stack as needed.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import * as cdk from "aws-cdk-lib";
|
|
10
|
-
* import type { Construct } from "constructs";
|
|
11
|
-
* import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
12
|
-
*
|
|
13
|
-
* // Import constructs from the bootstrap directory
|
|
14
|
-
* import CloudWatch from "@flipboxlabs/aws-audit-cdk/bootstrap/cloudwatch/construct";
|
|
15
|
-
* import DynamoDB from "@flipboxlabs/aws-audit-cdk/bootstrap/dynamodb/construct";
|
|
16
|
-
* import EventBridge from "@flipboxlabs/aws-audit-cdk/bootstrap/eventbridge/construct";
|
|
17
|
-
* import RestAPI from "@flipboxlabs/aws-audit-cdk/bootstrap/rest-api/construct";
|
|
18
|
-
*
|
|
19
|
-
* interface Props {
|
|
20
|
-
* config: CDKConfig;
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* export class AuditStack extends cdk.NestedStack {
|
|
24
|
-
* constructor(scope: Construct, id: string, props: Props) {
|
|
25
|
-
* super(scope, id, { description: "Audit" });
|
|
26
|
-
*
|
|
27
|
-
* // DynamoDB (storage)
|
|
28
|
-
* const { table } = new DynamoDB(this, "DynamoDB", { config: props.config });
|
|
29
|
-
*
|
|
30
|
-
* // EventBridge (events)
|
|
31
|
-
* const { eventBus } = new EventBridge(this, "EventBridge", {
|
|
32
|
-
* config: props.config,
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // CloudWatch (logging subscription)
|
|
36
|
-
* new CloudWatch(this, "CloudWatch", {
|
|
37
|
-
* config: props.config,
|
|
38
|
-
* table,
|
|
39
|
-
* eventBus,
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // REST API (optional)
|
|
43
|
-
* new RestAPI(this, "RestAPI", {
|
|
44
|
-
* config: props.config,
|
|
45
|
-
* table,
|
|
46
|
-
* eventBus,
|
|
47
|
-
* });
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export * from "./nodejs.function.js";
|
|
53
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,cAAc,sBAAsB,CAAC"}
|
package/dist/lib/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AWS Audit CDK Library
|
|
3
|
-
*
|
|
4
|
-
* Provides constructs for deploying audit infrastructure. Import and compose
|
|
5
|
-
* the constructs in your own stack as needed.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import * as cdk from "aws-cdk-lib";
|
|
10
|
-
* import type { Construct } from "constructs";
|
|
11
|
-
* import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
12
|
-
*
|
|
13
|
-
* // Import constructs from the bootstrap directory
|
|
14
|
-
* import CloudWatch from "@flipboxlabs/aws-audit-cdk/bootstrap/cloudwatch/construct";
|
|
15
|
-
* import DynamoDB from "@flipboxlabs/aws-audit-cdk/bootstrap/dynamodb/construct";
|
|
16
|
-
* import EventBridge from "@flipboxlabs/aws-audit-cdk/bootstrap/eventbridge/construct";
|
|
17
|
-
* import RestAPI from "@flipboxlabs/aws-audit-cdk/bootstrap/rest-api/construct";
|
|
18
|
-
*
|
|
19
|
-
* interface Props {
|
|
20
|
-
* config: CDKConfig;
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* export class AuditStack extends cdk.NestedStack {
|
|
24
|
-
* constructor(scope: Construct, id: string, props: Props) {
|
|
25
|
-
* super(scope, id, { description: "Audit" });
|
|
26
|
-
*
|
|
27
|
-
* // DynamoDB (storage)
|
|
28
|
-
* const { table } = new DynamoDB(this, "DynamoDB", { config: props.config });
|
|
29
|
-
*
|
|
30
|
-
* // EventBridge (events)
|
|
31
|
-
* const { eventBus } = new EventBridge(this, "EventBridge", {
|
|
32
|
-
* config: props.config,
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // CloudWatch (logging subscription)
|
|
36
|
-
* new CloudWatch(this, "CloudWatch", {
|
|
37
|
-
* config: props.config,
|
|
38
|
-
* table,
|
|
39
|
-
* eventBus,
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // REST API (optional)
|
|
43
|
-
* new RestAPI(this, "RestAPI", {
|
|
44
|
-
* config: props.config,
|
|
45
|
-
* table,
|
|
46
|
-
* eventBus,
|
|
47
|
-
* });
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export * from "./nodejs.function.js";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
|
|
2
|
-
import * as cdk from "aws-cdk-lib";
|
|
3
|
-
import * as nodejs from "aws-cdk-lib/aws-lambda-nodejs";
|
|
4
|
-
import type { Construct } from "constructs";
|
|
5
|
-
export declare const ESMNodeFunctionFactory: (config: CDKConfig) => (scope: Construct, id: string, props: nodejs.NodejsFunctionProps) => cdk.aws_lambda_nodejs.NodejsFunction;
|
|
6
|
-
//# sourceMappingURL=nodejs.function.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodejs.function.d.ts","sourceRoot":"","sources":["../../src/lib/nodejs.function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,MACjB,OAAO,SAAS,EAAE,IAAI,MAAM,EAAE,OAAO,MAAM,CAAC,mBAAmB,yCAyD/D,CAAC"}
|