forked from martysweet/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathawsData.ts
126 lines (91 loc) · 3.47 KB
/
awsData.ts
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
type AWSExtraDocs = {[k: string]: string}
export const awsExtraDocs = require('../data/aws_extra_docs.json') as AWSExtraDocs;
export type AWSPrimitiveType = 'String' | 'Integer' | 'Boolean' | 'Json' | 'Double' | 'Long' | 'Timestamp';
export interface PropertyBase {
Required: boolean,
Documentation: string,
UpdateType: 'Mutable' | 'Immutable' | 'Conditional',
}
export interface PrimitiveProperty extends PropertyBase {
PrimitiveType: AWSPrimitiveType,
Type: undefined
ItemType: undefined
PrimitiveItemType: undefined
}
export interface ComplexProperty extends PropertyBase {
Type: string,
PrimitiveType: undefined
ItemType: undefined
PrimitiveItemType: undefined
}
export interface ListPropertyBase extends PropertyBase {
Type: 'List',
DuplicatesAllowed: boolean,
PrimitiveType: undefined
}
export interface PrimitiveItemType {
PrimitiveItemType: AWSPrimitiveType,
ItemType: undefined
}
export interface ItemType {
ItemType: string,
PrimitiveItemType: undefined
}
export type ListProperty = ListPropertyBase & (PrimitiveItemType | ItemType)
export interface MapPropertyBase extends PropertyBase {
Type: 'Map',
DuplicatesAllowed: boolean,
PrimitiveType: undefined
ItemType: undefined
}
export type MapProperty = MapPropertyBase & (PrimitiveItemType | ItemType)
export type Property = PrimitiveProperty | ComplexProperty | ListProperty | MapProperty
export interface ResourcePropertyType {
Documentation: string,
Properties: {[propertyName: string]: Property | undefined}
AdditionalProperties: undefined;
}
export interface ResourceType {
Documentation: string,
Properties: {[propertyName: string]: Property | undefined},
Attributes?: {[attributeName: string]: Attribute | undefined},
AdditionalProperties?: boolean
}
export interface PrimitiveAttribute {
ItemType: AWSPrimitiveType
}
export interface ListAttribute {
Type: 'List',
PrimitiveItemType: AWSPrimitiveType
}
export type Attribute = PrimitiveAttribute | ListAttribute;
type AWSResourcesSpecification = {
PropertyTypes: {[propertyName: string]: ResourcePropertyType | undefined}
ResourceTypes: {[resourceName: string]: ResourceType | undefined}
}
export const awsResources = require('../data/aws_resources_specification.json') as AWSResourcesSpecification;
type ResourceRefTypes = {[resourceName: string]: string | undefined};
export const awsResourceRefTypes = require('../data/aws_resource_ref_types.json') as ResourceRefTypes;
type ParameterTypes = {[parameterName: string]: 'string' | 'number' | 'array' | undefined};
export const awsParameterTypes = require('../data/aws_parameter_types.json') as ParameterTypes;
type IntrinsicFunctions = {
[functionName: string]: {
supportedFunctions: string[]
}
}
export const awsIntrinsicFunctions = require('../data/aws_intrinsic_functions.json') as IntrinsicFunctions;
// avoid "does this exist" checks everywhere
for (let functionName in awsIntrinsicFunctions) {
awsIntrinsicFunctions[functionName].supportedFunctions = awsIntrinsicFunctions[functionName].supportedFunctions || [];
}
type RefOverrides = {
"AWS::AccountId": string,
"AWS::NotificationARNs": string[],
"AWS::NoValue": undefined,
"AWS::Region": string,
"AWS::StackId": string,
"AWS::StackName": string,
[refOverride: string]: any
};
export const awsRefOverrides = require('../data/aws_ref_override.json') as RefOverrides;
awsRefOverrides["AWS::NoValue"] = undefined;