This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
/
main.go
56 lines (42 loc) · 1.47 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"log"
"os"
)
/*
generate
Auto generates go parser code from the cloudformation spec
*/
const typesDir = "./pkg/parsers/types/"
const parsersDir = "./pkg/parsers/"
const propertiesDir = "./pkg/parsers/properties/"
const resourcesDir = "./pkg/parsers/resources/"
const mainPackageName = "parsers"
const sourceDir = "./generate/source/"
func init() {
log.Println("Creating directories")
os.RemoveAll(typesDir)
os.RemoveAll(propertiesDir)
os.RemoveAll(resourcesDir)
os.Mkdir(parsersDir, 0744)
os.Mkdir(propertiesDir, 0744)
os.Mkdir(resourcesDir, 0744)
log.Println("Created directories")
}
func main() {
var cfnSpec CfnSpec
// Download the latest Cloudformation Specification
log.Println("Download the latest Cloudformation Specification")
getCloudformationSpecification(sourceDir, cfnEndpoints)
// Load and de-dupe the specification
log.Println("Load and de-dupe the specification")
cfnSpec = buildUniqueSet(sourceDir, cfnEndpoints)
// Temporary fix for https://github.com/KablamoOSS/kombustion/issues/121
if cfnSpec.ResourceTypes["AWS::EC2::VPCEndpoint"].Properties["VPCEndpointType"].Documentation != "" {
cfnSpec.ResourceTypes["AWS::EC2::VPCEndpoint"].Properties["VpcEndpointType"] = cfnSpec.ResourceTypes["AWS::EC2::VPCEndpoint"].Properties["VPCEndpointType"]
delete(cfnSpec.ResourceTypes["AWS::EC2::VPCEndpoint"].Properties, "VPCEndpointType")
}
// Build the Yaml Parsers
log.Println("Build the Yaml Parsers")
buildYamlParsers(cfnSpec)
}