@servicevic-oss/cdk-cleanup-certificate-validation-records 0.0.4 → 0.0.5
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/.jsii +54 -9
- package/API.md +252 -0
- package/README.md +31 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +22 -4
- package/package.json +1 -1
package/.jsii
CHANGED
|
@@ -3512,7 +3512,7 @@
|
|
|
3512
3512
|
},
|
|
3513
3513
|
"name": "@servicevic-oss/cdk-cleanup-certificate-validation-records",
|
|
3514
3514
|
"readme": {
|
|
3515
|
-
"markdown": "# cdk-cleanup-certificate-validation-records\n\nThis CDK construct takes care of cleaning up the orphaned Route53 CNAME validation records\nleft behind when deleting a certificate that had DNS validation enabled.\n\nThe issue is better explained here: https://github.com/aws/aws-cdk/issues/11201\n\n## Usage\n\n### Explicit instantiation\n\nThe construct can be instantiated explicitely to cleanup after a specific certificate\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nexport class TestStack extends cdk.Stack {\n constructor(scope: Construct, id: string, props: TestStackProps) {\n super(scope, id, props);\n\n zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {\n zoneName: 'my.zone.net',\n });\n\n const cert1 = new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `mydomain.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n subjectAlternativeNames: [\n `mydomain2.${zone.zoneName}`,\n `mydomain3.${zone.zoneName}`,\n ],\n });\n const cert2 = new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `another.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n });\n\n new CertificateValidationRecordCleanup(this, `cleanup-${cert1.node.id}`, {\n certificate: cert1,\n hostedZone: zone,\n });\n\n new CertificateValidationRecordCleanup(this, `cleanup-${cert2.node.id}`, {\n certificate: cert2,\n hostedZone: zone,\n });\n };\n}\n```\n\n### Implicit instantiation using Aspects with knowledge of the hosted zone\n\nThe construct can be instantiated automatically against any Certificate resource created within a stack\nthrough the use of Aspects\n\nIn this example, we have knowledge of the hosted zone\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nexport class TestStack extends cdk.Stack {\n constructor(scope: Construct, id: string, props: TestStackProps) {\n super(scope, id, props);\n\n zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {\n zoneName: 'my.zone.net',\n });\n\n new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `mydomain.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n subjectAlternativeNames: [\n `mydomain2.${zone.zoneName}`,\n `mydomain3.${zone.zoneName}`,\n ],\n });\n new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `another.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n });\n\n cdk.Aspects.of(this).add({\n visit: (c) => {\n if (c instanceof cdk.aws_certificatemanager.Certificate) {\n new CertificateValidationRecordCleanup(this, `cleanup-${c.node.id}`, {\n certificate: c,\n hostedZone: zone,\n });\n }\n },\n });\n };\n}\n```\n\n### Implicit instantiation using Aspects without knowledge of the hosted zone\n\nThe construct can be instantiated automatically against any Certificate resource created within a stack\nthrough the use of Aspects\n\nIn this example, we have no knowledge of the hosted zone used to validate the certificate so we use a bit of brute force to derive it from the Certificate L1 resource\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nconst app = new cdk.App();\n\nconst blackBoxStack = new BlackBoxStack(app, 'my-blackbox-stack');\n\ncdk.Aspects.of(blackBoxStack).add({\n visit: (c) => {\n if (c instanceof cdk.aws_certificatemanager.Certificate) {\n const cfnRes = c.node.defaultChild as cdk.aws_certificatemanager.CfnCertificate;\n const valOpts = (cfnRes.domainValidationOptions as cdk.aws_certificatemanager.CfnCertificate.DomainValidationOptionProperty[])[0];\n\n new CertificateValidationRecordCleanup(c, `cleanup-${c.node.id}`, {\n certificate: c,\n hostedZone: cdk.aws_route53.HostedZone.fromHostedZoneId(c, `lookup-${c.node.id}`, valOpts.hostedZoneId!),\n });\n }\n },\n});\n```"
|
|
3515
|
+
"markdown": "# cdk-cleanup-certificate-validation-records\n\nThis CDK construct takes care of cleaning up the orphaned Route53 CNAME validation records\nleft behind when deleting a certificate that had DNS validation enabled.\n\nThe issue is better explained here: https://github.com/aws/aws-cdk/issues/11201\n\n## Usage\n\n### With wrapper class\n\nThe simplest usage is via the wrapper class `CertificateWithCleanup`.\n\nThe class extends the standard `Certificate` construct and adds the cleanup automatically\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nexport class TestStack extends cdk.Stack {\n constructor(scope: Construct, id: string, props: TestStackProps) {\n super(scope, id, props);\n\n zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {\n zoneName: 'my.zone.net',\n });\n\n const cert1 = new CertificateWithCleanup(this, 'Cert', {\n domainName: `mydomain.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n subjectAlternativeNames: [\n `mydomain2.${zone.zoneName}`,\n `mydomain3.${zone.zoneName}`,\n ],\n });\n };\n}\n```\n\n### Explicit instantiation\n\nThe construct can be instantiated explicitely to cleanup after a specific certificate\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nexport class TestStack extends cdk.Stack {\n constructor(scope: Construct, id: string, props: TestStackProps) {\n super(scope, id, props);\n\n zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {\n zoneName: 'my.zone.net',\n });\n\n const cert1 = new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `mydomain.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n subjectAlternativeNames: [\n `mydomain2.${zone.zoneName}`,\n `mydomain3.${zone.zoneName}`,\n ],\n });\n const cert2 = new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `another.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n });\n\n new CertificateValidationRecordCleanup(this, `cleanup-${cert1.node.id}`, {\n certificate: cert1,\n hostedZone: zone,\n });\n\n new CertificateValidationRecordCleanup(this, `cleanup-${cert2.node.id}`, {\n certificate: cert2,\n hostedZone: zone,\n });\n };\n}\n```\n\n### Implicit instantiation using Aspects with knowledge of the hosted zone\n\nThe construct can be instantiated automatically against any Certificate resource created within a stack\nthrough the use of Aspects\n\nIn this example, we have knowledge of the hosted zone\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nexport class TestStack extends cdk.Stack {\n constructor(scope: Construct, id: string, props: TestStackProps) {\n super(scope, id, props);\n\n zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {\n zoneName: 'my.zone.net',\n });\n\n new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `mydomain.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n subjectAlternativeNames: [\n `mydomain2.${zone.zoneName}`,\n `mydomain3.${zone.zoneName}`,\n ],\n });\n new cdk.aws_certificatemanager.Certificate(this, 'Cert', {\n domainName: `another.${zone.zoneName}`,\n validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),\n });\n\n cdk.Aspects.of(this).add({\n visit: (c) => {\n if (c instanceof cdk.aws_certificatemanager.Certificate) {\n new CertificateValidationRecordCleanup(this, `cleanup-${c.node.id}`, {\n certificate: c,\n hostedZone: zone,\n });\n }\n },\n });\n };\n}\n```\n\n### Implicit instantiation using Aspects without knowledge of the hosted zone\n\nThe construct can be instantiated automatically against any Certificate resource created within a stack\nthrough the use of Aspects\n\nIn this example, we have no knowledge of the hosted zone used to validate the certificate so we use a bit of brute force to derive it from the Certificate L1 resource\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { CertificateValidationRecordCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'\n\nconst app = new cdk.App();\n\nconst blackBoxStack = new BlackBoxStack(app, 'my-blackbox-stack');\n\ncdk.Aspects.of(blackBoxStack).add({\n visit: (c) => {\n if (c instanceof cdk.aws_certificatemanager.Certificate) {\n const cfnRes = c.node.defaultChild as cdk.aws_certificatemanager.CfnCertificate;\n const valOpts = (cfnRes.domainValidationOptions as cdk.aws_certificatemanager.CfnCertificate.DomainValidationOptionProperty[])[0];\n\n new CertificateValidationRecordCleanup(c, `cleanup-${c.node.id}`, {\n certificate: c,\n hostedZone: cdk.aws_route53.HostedZone.fromHostedZoneId(c, `lookup-${c.node.id}`, valOpts.hostedZoneId!),\n });\n }\n },\n});\n```"
|
|
3516
3516
|
},
|
|
3517
3517
|
"repository": {
|
|
3518
3518
|
"type": "git",
|
|
@@ -3539,7 +3539,7 @@
|
|
|
3539
3539
|
},
|
|
3540
3540
|
"locationInModule": {
|
|
3541
3541
|
"filename": "src/index.ts",
|
|
3542
|
-
"line":
|
|
3542
|
+
"line": 28
|
|
3543
3543
|
},
|
|
3544
3544
|
"parameters": [
|
|
3545
3545
|
{
|
|
@@ -3565,7 +3565,7 @@
|
|
|
3565
3565
|
"kind": "class",
|
|
3566
3566
|
"locationInModule": {
|
|
3567
3567
|
"filename": "src/index.ts",
|
|
3568
|
-
"line":
|
|
3568
|
+
"line": 21
|
|
3569
3569
|
},
|
|
3570
3570
|
"name": "CertificateValidationRecordCleanup",
|
|
3571
3571
|
"properties": [
|
|
@@ -3577,7 +3577,7 @@
|
|
|
3577
3577
|
"immutable": true,
|
|
3578
3578
|
"locationInModule": {
|
|
3579
3579
|
"filename": "src/index.ts",
|
|
3580
|
-
"line":
|
|
3580
|
+
"line": 22
|
|
3581
3581
|
},
|
|
3582
3582
|
"name": "HANDLER_UID",
|
|
3583
3583
|
"static": true,
|
|
@@ -3593,7 +3593,7 @@
|
|
|
3593
3593
|
"immutable": true,
|
|
3594
3594
|
"locationInModule": {
|
|
3595
3595
|
"filename": "src/index.ts",
|
|
3596
|
-
"line":
|
|
3596
|
+
"line": 23
|
|
3597
3597
|
},
|
|
3598
3598
|
"name": "PROVIDER_UID",
|
|
3599
3599
|
"static": true,
|
|
@@ -3608,7 +3608,7 @@
|
|
|
3608
3608
|
"immutable": true,
|
|
3609
3609
|
"locationInModule": {
|
|
3610
3610
|
"filename": "src/index.ts",
|
|
3611
|
-
"line":
|
|
3611
|
+
"line": 25
|
|
3612
3612
|
},
|
|
3613
3613
|
"name": "handlerFunction",
|
|
3614
3614
|
"type": {
|
|
@@ -3622,7 +3622,7 @@
|
|
|
3622
3622
|
"immutable": true,
|
|
3623
3623
|
"locationInModule": {
|
|
3624
3624
|
"filename": "src/index.ts",
|
|
3625
|
-
"line":
|
|
3625
|
+
"line": 26
|
|
3626
3626
|
},
|
|
3627
3627
|
"name": "provider",
|
|
3628
3628
|
"type": {
|
|
@@ -3680,8 +3680,53 @@
|
|
|
3680
3680
|
}
|
|
3681
3681
|
],
|
|
3682
3682
|
"symbolId": "src/index:CertificateValidationRecordCleanupProps"
|
|
3683
|
+
},
|
|
3684
|
+
"@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup": {
|
|
3685
|
+
"assembly": "@servicevic-oss/cdk-cleanup-certificate-validation-records",
|
|
3686
|
+
"base": "aws-cdk-lib.aws_certificatemanager.Certificate",
|
|
3687
|
+
"docs": {
|
|
3688
|
+
"stability": "stable",
|
|
3689
|
+
"summary": "A wrapper class for a vanilla `Certificate` object with automatic cleanup attached."
|
|
3690
|
+
},
|
|
3691
|
+
"fqn": "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup",
|
|
3692
|
+
"initializer": {
|
|
3693
|
+
"docs": {
|
|
3694
|
+
"stability": "stable"
|
|
3695
|
+
},
|
|
3696
|
+
"locationInModule": {
|
|
3697
|
+
"filename": "src/index.ts",
|
|
3698
|
+
"line": 83
|
|
3699
|
+
},
|
|
3700
|
+
"parameters": [
|
|
3701
|
+
{
|
|
3702
|
+
"name": "scope",
|
|
3703
|
+
"type": {
|
|
3704
|
+
"fqn": "constructs.Construct"
|
|
3705
|
+
}
|
|
3706
|
+
},
|
|
3707
|
+
{
|
|
3708
|
+
"name": "id",
|
|
3709
|
+
"type": {
|
|
3710
|
+
"primitive": "string"
|
|
3711
|
+
}
|
|
3712
|
+
},
|
|
3713
|
+
{
|
|
3714
|
+
"name": "props",
|
|
3715
|
+
"type": {
|
|
3716
|
+
"fqn": "aws-cdk-lib.aws_certificatemanager.CertificateProps"
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
]
|
|
3720
|
+
},
|
|
3721
|
+
"kind": "class",
|
|
3722
|
+
"locationInModule": {
|
|
3723
|
+
"filename": "src/index.ts",
|
|
3724
|
+
"line": 82
|
|
3725
|
+
},
|
|
3726
|
+
"name": "CertificateWithCleanup",
|
|
3727
|
+
"symbolId": "src/index:CertificateWithCleanup"
|
|
3683
3728
|
}
|
|
3684
3729
|
},
|
|
3685
|
-
"version": "0.0.
|
|
3686
|
-
"fingerprint": "
|
|
3730
|
+
"version": "0.0.5",
|
|
3731
|
+
"fingerprint": "UafwXbzrVQ+w/HkYQuecTqQ/tbyP36YcwCVYCgconEA="
|
|
3687
3732
|
}
|
package/API.md
CHANGED
|
@@ -153,6 +153,258 @@ public readonly PROVIDER_UID: string;
|
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
156
|
+
### CertificateWithCleanup <a name="CertificateWithCleanup" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup"></a>
|
|
157
|
+
|
|
158
|
+
A wrapper class for a vanilla `Certificate` object with automatic cleanup attached.
|
|
159
|
+
|
|
160
|
+
#### Initializers <a name="Initializers" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer"></a>
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
164
|
+
|
|
165
|
+
new CertificateWithCleanup(scope: Construct, id: string, props: CertificateProps)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
| **Name** | **Type** | **Description** |
|
|
169
|
+
| --- | --- | --- |
|
|
170
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
171
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
172
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.props">props</a></code> | <code>aws-cdk-lib.aws_certificatemanager.CertificateProps</code> | *No description.* |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.scope"></a>
|
|
177
|
+
|
|
178
|
+
- *Type:* constructs.Construct
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
##### `id`<sup>Required</sup> <a name="id" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.id"></a>
|
|
183
|
+
|
|
184
|
+
- *Type:* string
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
##### `props`<sup>Required</sup> <a name="props" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.Initializer.parameter.props"></a>
|
|
189
|
+
|
|
190
|
+
- *Type:* aws-cdk-lib.aws_certificatemanager.CertificateProps
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
195
|
+
|
|
196
|
+
| **Name** | **Description** |
|
|
197
|
+
| --- | --- |
|
|
198
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
199
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
200
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.metricDaysToExpiry">metricDaysToExpiry</a></code> | Return the DaysToExpiry metric for this AWS Certificate Manager Certificate. By default, this is the minimum value over 1 day. |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
##### `toString` <a name="toString" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.toString"></a>
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
public toString(): string
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Returns a string representation of this construct.
|
|
211
|
+
|
|
212
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.applyRemovalPolicy"></a>
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Apply the given removal policy to this resource.
|
|
219
|
+
|
|
220
|
+
The Removal Policy controls what happens to this resource when it stops
|
|
221
|
+
being managed by CloudFormation, either because you've removed it from the
|
|
222
|
+
CDK application or because you've made a change that requires the resource
|
|
223
|
+
to be replaced.
|
|
224
|
+
|
|
225
|
+
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
226
|
+
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
227
|
+
|
|
228
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.applyRemovalPolicy.parameter.policy"></a>
|
|
229
|
+
|
|
230
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
##### `metricDaysToExpiry` <a name="metricDaysToExpiry" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.metricDaysToExpiry"></a>
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
public metricDaysToExpiry(props?: MetricOptions): Metric
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Return the DaysToExpiry metric for this AWS Certificate Manager Certificate. By default, this is the minimum value over 1 day.
|
|
241
|
+
|
|
242
|
+
This metric is no longer emitted once the certificate has effectively
|
|
243
|
+
expired, so alarms configured on this metric should probably treat missing
|
|
244
|
+
data as "breaching".
|
|
245
|
+
|
|
246
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.metricDaysToExpiry.parameter.props"></a>
|
|
247
|
+
|
|
248
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
253
|
+
|
|
254
|
+
| **Name** | **Description** |
|
|
255
|
+
| --- | --- |
|
|
256
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
257
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
258
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
259
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.fromCertificateArn">fromCertificateArn</a></code> | Import a certificate. |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
##### ~~`isConstruct`~~ <a name="isConstruct" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isConstruct"></a>
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
267
|
+
|
|
268
|
+
CertificateWithCleanup.isConstruct(x: any)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Checks if `x` is a construct.
|
|
272
|
+
|
|
273
|
+
###### `x`<sup>Required</sup> <a name="x" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isConstruct.parameter.x"></a>
|
|
274
|
+
|
|
275
|
+
- *Type:* any
|
|
276
|
+
|
|
277
|
+
Any object.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isOwnedResource"></a>
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
285
|
+
|
|
286
|
+
CertificateWithCleanup.isOwnedResource(construct: IConstruct)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Returns true if the construct was created by CDK, and false otherwise.
|
|
290
|
+
|
|
291
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isOwnedResource.parameter.construct"></a>
|
|
292
|
+
|
|
293
|
+
- *Type:* constructs.IConstruct
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
##### `isResource` <a name="isResource" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isResource"></a>
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
301
|
+
|
|
302
|
+
CertificateWithCleanup.isResource(construct: IConstruct)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Check whether the given construct is a Resource.
|
|
306
|
+
|
|
307
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.isResource.parameter.construct"></a>
|
|
308
|
+
|
|
309
|
+
- *Type:* constructs.IConstruct
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
##### `fromCertificateArn` <a name="fromCertificateArn" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.fromCertificateArn"></a>
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
317
|
+
|
|
318
|
+
CertificateWithCleanup.fromCertificateArn(scope: Construct, id: string, certificateArn: string)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Import a certificate.
|
|
322
|
+
|
|
323
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.fromCertificateArn.parameter.scope"></a>
|
|
324
|
+
|
|
325
|
+
- *Type:* constructs.Construct
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
###### `id`<sup>Required</sup> <a name="id" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.fromCertificateArn.parameter.id"></a>
|
|
330
|
+
|
|
331
|
+
- *Type:* string
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
###### `certificateArn`<sup>Required</sup> <a name="certificateArn" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.fromCertificateArn.parameter.certificateArn"></a>
|
|
336
|
+
|
|
337
|
+
- *Type:* string
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
342
|
+
|
|
343
|
+
| **Name** | **Type** | **Description** |
|
|
344
|
+
| --- | --- | --- |
|
|
345
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
346
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
347
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
348
|
+
| <code><a href="#@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.certificateArn">certificateArn</a></code> | <code>string</code> | The certificate's ARN. |
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
##### `node`<sup>Required</sup> <a name="node" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.node"></a>
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
public readonly node: Node;
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
- *Type:* constructs.Node
|
|
359
|
+
|
|
360
|
+
The tree node.
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
##### `env`<sup>Required</sup> <a name="env" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.env"></a>
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
public readonly env: ResourceEnvironment;
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
- *Type:* aws-cdk-lib.ResourceEnvironment
|
|
371
|
+
|
|
372
|
+
The environment this resource belongs to.
|
|
373
|
+
|
|
374
|
+
For resources that are created and managed by the CDK
|
|
375
|
+
(generally, those created by creating new class instances like Role, Bucket, etc.),
|
|
376
|
+
this is always the same as the environment of the stack they belong to;
|
|
377
|
+
however, for imported resources
|
|
378
|
+
(those obtained from static methods like fromRoleArn, fromBucketName, etc.),
|
|
379
|
+
that might be different than the stack they were imported into.
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.stack"></a>
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
public readonly stack: Stack;
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
- *Type:* aws-cdk-lib.Stack
|
|
390
|
+
|
|
391
|
+
The stack in which this resource is defined.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
##### `certificateArn`<sup>Required</sup> <a name="certificateArn" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup.property.certificateArn"></a>
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
public readonly certificateArn: string;
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
- *Type:* string
|
|
402
|
+
|
|
403
|
+
The certificate's ARN.
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
|
|
156
408
|
## Structs <a name="Structs" id="Structs"></a>
|
|
157
409
|
|
|
158
410
|
### CertificateValidationRecordCleanupProps <a name="CertificateValidationRecordCleanupProps" id="@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateValidationRecordCleanupProps"></a>
|
package/README.md
CHANGED
|
@@ -7,6 +7,37 @@ The issue is better explained here: https://github.com/aws/aws-cdk/issues/11201
|
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
10
|
+
### With wrapper class
|
|
11
|
+
|
|
12
|
+
The simplest usage is via the wrapper class `CertificateWithCleanup`.
|
|
13
|
+
|
|
14
|
+
The class extends the standard `Certificate` construct and adds the cleanup automatically
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import * as cdk from 'aws-cdk-lib';
|
|
18
|
+
import { Construct } from 'constructs';
|
|
19
|
+
import { CertificateWithCleanup } from '@servicevic-oss/cdk-cleanup-certificate-validation-records'
|
|
20
|
+
|
|
21
|
+
export class TestStack extends cdk.Stack {
|
|
22
|
+
constructor(scope: Construct, id: string, props: TestStackProps) {
|
|
23
|
+
super(scope, id, props);
|
|
24
|
+
|
|
25
|
+
zone = new cdk.aws_route53.PublicHostedZone(this, 'Zone', {
|
|
26
|
+
zoneName: 'my.zone.net',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const cert1 = new CertificateWithCleanup(this, 'Cert', {
|
|
30
|
+
domainName: `mydomain.${zone.zoneName}`,
|
|
31
|
+
validation: cdk.aws_certificatemanager.CertificateValidation.fromDns(zone),
|
|
32
|
+
subjectAlternativeNames: [
|
|
33
|
+
`mydomain2.${zone.zoneName}`,
|
|
34
|
+
`mydomain3.${zone.zoneName}`,
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
10
41
|
### Explicit instantiation
|
|
11
42
|
|
|
12
43
|
The construct can be instantiated explicitely to cleanup after a specific certificate
|
package/lib/index.d.ts
CHANGED
|
@@ -23,3 +23,9 @@ export declare class CertificateValidationRecordCleanup extends Construct {
|
|
|
23
23
|
private getOrCreateFunction;
|
|
24
24
|
private getOrCreateProvider;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A wrapper class for a vanilla `Certificate` object with automatic cleanup attached
|
|
28
|
+
*/
|
|
29
|
+
export declare class CertificateWithCleanup extends cdk.aws_certificatemanager.Certificate {
|
|
30
|
+
constructor(scope: Construct, id: string, props: cdk.aws_certificatemanager.CertificateProps);
|
|
31
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
2
|
+
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CertificateValidationRecordCleanup = void 0;
|
|
4
|
+
exports.CertificateWithCleanup = exports.CertificateValidationRecordCleanup = void 0;
|
|
5
5
|
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const cdk = require("aws-cdk-lib");
|
|
@@ -57,7 +57,25 @@ class CertificateValidationRecordCleanup extends constructs_1.Construct {
|
|
|
57
57
|
}
|
|
58
58
|
exports.CertificateValidationRecordCleanup = CertificateValidationRecordCleanup;
|
|
59
59
|
_a = JSII_RTTI_SYMBOL_1;
|
|
60
|
-
CertificateValidationRecordCleanup[_a] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateValidationRecordCleanup", version: "0.0.
|
|
60
|
+
CertificateValidationRecordCleanup[_a] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateValidationRecordCleanup", version: "0.0.5" };
|
|
61
61
|
CertificateValidationRecordCleanup.HANDLER_UID = 'CertRecordsCleanupHandler-2B663BAB-7981';
|
|
62
62
|
CertificateValidationRecordCleanup.PROVIDER_UID = 'CertRecordsCleanupProvider-57EBF059-2E26';
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* A wrapper class for a vanilla `Certificate` object with automatic cleanup attached
|
|
65
|
+
*/
|
|
66
|
+
class CertificateWithCleanup extends cdk.aws_certificatemanager.Certificate {
|
|
67
|
+
constructor(scope, id, props) {
|
|
68
|
+
super(scope, id, props);
|
|
69
|
+
if (props.validation && props.validation.props.hostedZone && props.validation?.method == cdk.aws_certificatemanager.ValidationMethod.DNS) {
|
|
70
|
+
// Attach a cleanup construct
|
|
71
|
+
new CertificateValidationRecordCleanup(this, `cleanup-${id}`, {
|
|
72
|
+
certificate: this,
|
|
73
|
+
hostedZone: props.validation.props.hostedZone,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.CertificateWithCleanup = CertificateWithCleanup;
|
|
79
|
+
_b = JSII_RTTI_SYMBOL_1;
|
|
80
|
+
CertificateWithCleanup[_b] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup", version: "0.0.5" };
|
|
81
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwrQkFBNEI7QUFDNUIsbUNBQW1DO0FBQ25DLDJDQUF1QztBQWN2Qzs7O0dBR0c7QUFDSCxNQUFhLGtDQUFtQyxTQUFRLHNCQUFTO0lBTy9ELFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBOEM7UUFDdEYsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixJQUFJLENBQUMsZUFBZSxHQUFHLElBQUksQ0FBQyxtQkFBbUIsRUFBRSxDQUFDO1FBQ2xELElBQUksQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFM0MsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLEVBQUUsb0JBQW9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