Skip to content

Commit

Permalink
Merge pull request #3 from cultureamp/cdk-v2-support
Browse files Browse the repository at this point in the history
feat: support AWS CDK v2
  • Loading branch information
jamestelfer authored Jan 24, 2024
2 parents ad2ce51 + eba3cd2 commit bc6c552
Show file tree
Hide file tree
Showing 30 changed files with 852 additions and 418 deletions.
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@cultureamp:registry=https://npm.pkg.github.com/

# configure publishing with environment variables
//npm.pkg.github.com/:_authToken='${GITHUB_REGISTRY_PUBLISH_TOKEN}'
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Culture Amp defaults
/** @type {import("prettier").Options} */
module.exports = {
arrowParens: "avoid",
semi: false,
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 16.20.0
nodejs 16.20.2
pnpm 8.5.1
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.suggestionActions.enabled": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
}
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CDK constructs for the [DataDog CFN resources](https://github.com/DataDog/datado
> In order to use these resources, you need to ensure that they are configured
> in your environment. See instructions in the above repo.
Currently support AWS CDK v1 (v2 coming) on the following resource types:
Currently supports AWS CDK v2 [^1] on the following resource types:

- `Datadog::Dashboards::Dashboard`
- `Datadog::Monitors::Monitor`
Expand All @@ -14,11 +14,13 @@ Currently support AWS CDK v1 (v2 coming) on the following resource types:
- `Datadog::SLOs::SLO`
- `Creator` attribute not directly supported (use an escape hatch)

[^1]: v1 support is present via the v1.0.0 release of the package

## Status

This package is currently released as a public package on the Github NPM repository.

Still to be considered v1:
Contributions welcome for:

- [ ] unit tests for all L1 constructs
- [ ] integration tests for all L1 constructs
Expand All @@ -27,3 +29,12 @@ Still to be considered v1:

Contributions are welcome: be sure to open an issue though before embarking on
any large-scale endeavours!

## Publishing

Publishing requires a GH token in the environment named `GITHUB_REGISTRY_PUBLISH_TOKEN`. It requires `repo` and `write:packages` permissions.

```shell
pnpm run prebuildpackage
npm publish
```
10 changes: 8 additions & 2 deletions __integration__/integ.slo.metric.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import * as cdk from "@aws-cdk/core"
import * as cdk from "aws-cdk-lib"
import * as test from "@aws-cdk/integ-tests-alpha"

import { CfnSlo, CfnSloPropsType, ThresholdTimeframe } from "../src"

const app = new cdk.App()
const app = new cdk.App({
defaultStackSynthesizer: new cdk.CliCredentialsStackSynthesizer(),
})
const stack = new cdk.Stack(app, "datadogcdk-integration-slo-metric")

// create a metric-based SLO
Expand All @@ -24,3 +28,5 @@ new CfnSlo(stack, "TestSlo", {
// tag for visibility if the SLO sticks around
tags: ["repo:datadog-cdk", "env:test", "type:cdk-integration-test"],
})

new test.IntegTest(app, "Integ", { testCases: [stack] })
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "35.0.0",
"files": {
"7f67f0cfb545865643badf7be7f46e59c1f2c5de8689c60571879e517bae2f48": {
"source": {
"path": "datadogcdk-integration-slo-metric.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "7f67f0cfb545865643badf7be7f46e59c1f2c5de8689c60571879e517bae2f48.json"
}
}
},
"44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a": {
"source": {
"path": "IntegDefaultTestDeployAssert4E6713E1.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.json"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "35.0.0",
"files": {
"7f67f0cfb545865643badf7be7f46e59c1f2c5de8689c60571879e517bae2f48": {
"source": {
"path": "datadogcdk-integration-slo-metric.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "7f67f0cfb545865643badf7be7f46e59c1f2c5de8689c60571879e517bae2f48.json"
}
}
}
},
"dockerImages": {}
}
12 changes: 12 additions & 0 deletions __integration__/integ.slo.metric.ts.snapshot/integ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "35.0.0",
"testCases": {
"Integ/DefaultTest": {
"stacks": [
"datadogcdk-integration-slo-metric"
],
"assertionStack": "Integ/DefaultTest/DeployAssert",
"assertionStackName": "IntegDefaultTestDeployAssert4E6713E1"
}
}
}
65 changes: 65 additions & 0 deletions __integration__/integ.slo.metric.ts.snapshot/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": "36.0.0",
"artifacts": {
"datadogcdk-integration-slo-metric.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "datadogcdk-integration-slo-metric.assets.json"
}
},
"datadogcdk-integration-slo-metric": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "datadogcdk-integration-slo-metric.template.json",
"terminationProtection": false,
"validateOnSynth": false,
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7f67f0cfb545865643badf7be7f46e59c1f2c5de8689c60571879e517bae2f48.json",
"additionalDependencies": [
"datadogcdk-integration-slo-metric.assets"
]
},
"dependencies": [
"datadogcdk-integration-slo-metric.assets"
],
"metadata": {
"/datadogcdk-integration-slo-metric/TestSlo": [
{
"type": "aws:cdk:logicalId",
"data": "TestSlo"
}
]
},
"displayName": "datadogcdk-integration-slo-metric"
},
"IntegDefaultTestDeployAssert4E6713E1.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "IntegDefaultTestDeployAssert4E6713E1.assets.json"
}
},
"IntegDefaultTestDeployAssert4E6713E1": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "IntegDefaultTestDeployAssert4E6713E1.template.json",
"terminationProtection": false,
"validateOnSynth": false,
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.json",
"additionalDependencies": [
"IntegDefaultTestDeployAssert4E6713E1.assets"
]
},
"dependencies": [
"IntegDefaultTestDeployAssert4E6713E1.assets"
],
"displayName": "Integ/DefaultTest/DeployAssert"
},
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
}
}
}
75 changes: 75 additions & 0 deletions __integration__/integ.slo.metric.ts.snapshot/tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"version": "tree-0.1",
"tree": {
"id": "App",
"path": "",
"children": {
"datadogcdk-integration-slo-metric": {
"id": "datadogcdk-integration-slo-metric",
"path": "datadogcdk-integration-slo-metric",
"children": {
"TestSlo": {
"id": "TestSlo",
"path": "datadogcdk-integration-slo-metric/TestSlo",
"constructInfo": {
"fqn": "aws-cdk-lib.CfnResource",
"version": "2.112.0"
}
}
},
"constructInfo": {
"fqn": "aws-cdk-lib.Stack",
"version": "2.112.0"
}
},
"Integ": {
"id": "Integ",
"path": "Integ",
"children": {
"DefaultTest": {
"id": "DefaultTest",
"path": "Integ/DefaultTest",
"children": {
"Default": {
"id": "Default",
"path": "Integ/DefaultTest/Default",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.0.0"
}
},
"DeployAssert": {
"id": "DeployAssert",
"path": "Integ/DefaultTest/DeployAssert",
"constructInfo": {
"fqn": "aws-cdk-lib.Stack",
"version": "2.112.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase",
"version": "2.122.0-alpha.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/integ-tests-alpha.IntegTest",
"version": "2.122.0-alpha.0"
}
},
"Tree": {
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.0.0"
}
}
},
"constructInfo": {
"fqn": "aws-cdk-lib.App",
"version": "2.112.0"
}
}
}
14 changes: 0 additions & 14 deletions __integration__/slo.metric.integ.snapshot/integ.json

This file was deleted.

28 changes: 0 additions & 28 deletions __integration__/slo.metric.integ.snapshot/manifest.json

This file was deleted.

39 changes: 0 additions & 39 deletions __integration__/slo.metric.integ.snapshot/tree.json

This file was deleted.

Loading

0 comments on commit bc6c552

Please sign in to comment.