@byaga/cdk-patterns 0.1.0
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/ApiCertificate.ts +32 -0
- package/cdk-patterns.iml +9 -0
- package/package.json +16 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
import {IDeployStack} from "./IDeployStack";
|
2
|
+
import {DnsValidatedCertificate} from "aws-cdk-lib/aws-certificatemanager";
|
3
|
+
import {HostedZone, IHostedZone} from "aws-cdk-lib/aws-route53";
|
4
|
+
import {CfnOutput} from "aws-cdk-lib";
|
5
|
+
import {IDomainConfig} from "./IDomainConfig";
|
6
|
+
|
7
|
+
export default class ApiCertificate extends DnsValidatedCertificate {
|
8
|
+
hostedZone: IHostedZone
|
9
|
+
domain: string
|
10
|
+
|
11
|
+
constructor(stack: IDeployStack, id: string, domain: IDomainConfig) {
|
12
|
+
const certDomain = [domain.domainName]
|
13
|
+
if (domain.subdomain) certDomain.splice(0, 0, domain.subdomain)
|
14
|
+
const domainName = certDomain.join('.')
|
15
|
+
|
16
|
+
console.log(1, domainName, domain)
|
17
|
+
const hostedZone: IHostedZone = HostedZone.fromHostedZoneAttributes(stack, stack.genId(id, 'hosted-zone'), {
|
18
|
+
hostedZoneId: domain.hostedZone.id,
|
19
|
+
zoneName: domain.hostedZone.name
|
20
|
+
})
|
21
|
+
super(stack, stack.genId(id), {
|
22
|
+
domainName,
|
23
|
+
hostedZone
|
24
|
+
});
|
25
|
+
|
26
|
+
this.domain = domainName
|
27
|
+
new CfnOutput(this, stack.genId(id, "certificate-output"), {
|
28
|
+
value: this.certificateArn ,
|
29
|
+
exportName: stack.genName(id)})
|
30
|
+
this.hostedZone = hostedZone
|
31
|
+
}
|
32
|
+
}
|
package/cdk-patterns.iml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
6
|
+
<orderEntry type="inheritedJdk" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
</component>
|
9
|
+
</module>
|
package/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "@byaga/cdk-patterns",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "Collection of common patterns used when making AWS CloudFormation templates using CDK",
|
5
|
+
"main": " ",
|
6
|
+
"scripts": {
|
7
|
+
"test": " "
|
8
|
+
},
|
9
|
+
"keywords": [
|
10
|
+
"CDK",
|
11
|
+
"CloudFormation",
|
12
|
+
"AWS"
|
13
|
+
],
|
14
|
+
"author": "VeryFineHat",
|
15
|
+
"license": "MIT"
|
16
|
+
}
|