Skip to content

Commit 8707ab8

Browse files
fatbasstardcmmeyer
authored andcommitted
Add DocumentDB Allowed Values (aws-cloudformation#711)
* Add DocumebtDB Instance class loading from the Pricing API * Add DocumentDB Allowed Values
1 parent 6aa384e commit 8707ab8

31 files changed

+425
-12
lines changed

scripts/update_specs_from_pricing.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def get_redshift_pricing():
131131
return results
132132

133133
def get_dax_pricing():
134-
135134
LOGGER.info('Get DAX pricing')
136135
paginator = client.get_paginator('get_products')
137136
page_iterator = paginator.paginate(
@@ -154,7 +153,6 @@ def get_dax_pricing():
154153
)
155154
return results
156155

157-
158156
def get_mq_pricing():
159157
""" Get MQ Instance Pricing """
160158
LOGGER.info('Get AmazonMQ pricing')
@@ -184,7 +182,6 @@ def get_mq_pricing():
184182
)
185183
return results
186184

187-
188185
def get_rds_pricing():
189186
""" Get RDS Pricing """
190187
LOGGER.info('Get RDS pricing')
@@ -208,6 +205,27 @@ def get_rds_pricing():
208205
)
209206
return results
210207

208+
def get_documentdb_pricing():
209+
LOGGER.info('Get DocumentDB pricing')
210+
paginator = client.get_paginator('get_products')
211+
page_iterator = paginator.paginate(
212+
ServiceCode='AmazonDocDB',
213+
FormatVersion='aws_v1',
214+
)
215+
216+
results = {}
217+
for page in page_iterator:
218+
for price_item in page.get('PriceList', []):
219+
products = json.loads(price_item)
220+
product = products.get('product', {})
221+
if product:
222+
if product.get('productFamily') == 'Database Instance':
223+
if not results.get(region_map[product.get('attributes').get('location')]):
224+
results[region_map[product.get('attributes').get('location')]] = set()
225+
results[region_map[product.get('attributes').get('location')]].add(
226+
product.get('attributes').get('instanceType')
227+
)
228+
return results
211229

212230
def main():
213231
""" main function """
@@ -222,6 +240,7 @@ def main():
222240
outputs = update_outputs('RdsInstanceType', get_rds_pricing(), outputs)
223241
outputs = update_outputs('RedshiftInstanceType', get_redshift_pricing(), outputs)
224242
outputs = update_outputs('DAXInstanceType', get_dax_pricing(), outputs)
243+
outputs = update_outputs('DocumentDBInstanceClass', get_documentdb_pricing(), outputs)
225244

226245
LOGGER.info('Updating spec files')
227246
for region, patches in outputs.items():

src/cfnlint/data/CloudSpecs/ap-northeast-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33620,6 +33620,18 @@
3362033620
"target"
3362133621
]
3362233622
},
33623+
"DocumentDBEngineVersion": {
33624+
"AllowedValues": [
33625+
"docdb"
33626+
]
33627+
},
33628+
"DocumentDBInstanceClass": {
33629+
"Ref": {
33630+
"Parameters": [
33631+
"String"
33632+
]
33633+
}
33634+
},
3362333635
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
3362433636
"AllowedValues": [
3362533637
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ap-northeast-2.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31393,6 +31393,18 @@
3139331393
"target"
3139431394
]
3139531395
},
31396+
"DocumentDBEngineVersion": {
31397+
"AllowedValues": [
31398+
"docdb"
31399+
]
31400+
},
31401+
"DocumentDBInstanceClass": {
31402+
"Ref": {
31403+
"Parameters": [
31404+
"String"
31405+
]
31406+
}
31407+
},
3139631408
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
3139731409
"AllowedValues": [
3139831410
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ap-northeast-3.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21869,6 +21869,18 @@
2186921869
"target"
2187021870
]
2187121871
},
21872+
"DocumentDBEngineVersion": {
21873+
"AllowedValues": [
21874+
"docdb"
21875+
]
21876+
},
21877+
"DocumentDBInstanceClass": {
21878+
"Ref": {
21879+
"Parameters": [
21880+
"String"
21881+
]
21882+
}
21883+
},
2187221884
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
2187321885
"AllowedValues": [
2187421886
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ap-south-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29708,6 +29708,18 @@
2970829708
"target"
2970929709
]
2971029710
},
29711+
"DocumentDBEngineVersion": {
29712+
"AllowedValues": [
29713+
"docdb"
29714+
]
29715+
},
29716+
"DocumentDBInstanceClass": {
29717+
"Ref": {
29718+
"Parameters": [
29719+
"String"
29720+
]
29721+
}
29722+
},
2971129723
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
2971229724
"AllowedValues": [
2971329725
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ap-southeast-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31013,6 +31013,18 @@
3101331013
"target"
3101431014
]
3101531015
},
31016+
"DocumentDBEngineVersion": {
31017+
"AllowedValues": [
31018+
"docdb"
31019+
]
31020+
},
31021+
"DocumentDBInstanceClass": {
31022+
"Ref": {
31023+
"Parameters": [
31024+
"String"
31025+
]
31026+
}
31027+
},
3101631028
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
3101731029
"AllowedValues": [
3101831030
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ap-southeast-2.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32104,6 +32104,18 @@
3210432104
"target"
3210532105
]
3210632106
},
32107+
"DocumentDBEngineVersion": {
32108+
"AllowedValues": [
32109+
"docdb"
32110+
]
32111+
},
32112+
"DocumentDBInstanceClass": {
32113+
"Ref": {
32114+
"Parameters": [
32115+
"String"
32116+
]
32117+
}
32118+
},
3210732119
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
3210832120
"AllowedValues": [
3210932121
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/ca-central-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28053,6 +28053,18 @@
2805328053
"target"
2805428054
]
2805528055
},
28056+
"DocumentDBEngineVersion": {
28057+
"AllowedValues": [
28058+
"docdb"
28059+
]
28060+
},
28061+
"DocumentDBInstanceClass": {
28062+
"Ref": {
28063+
"Parameters": [
28064+
"String"
28065+
]
28066+
}
28067+
},
2805628068
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
2805728069
"AllowedValues": [
2805828070
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/eu-central-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32791,6 +32791,18 @@
3279132791
"target"
3279232792
]
3279332793
},
32794+
"DocumentDBEngineVersion": {
32795+
"AllowedValues": [
32796+
"docdb"
32797+
]
32798+
},
32799+
"DocumentDBInstanceClass": {
32800+
"Ref": {
32801+
"Parameters": [
32802+
"String"
32803+
]
32804+
}
32805+
},
3279432806
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
3279532807
"AllowedValues": [
3279632808
"ALBRequestCountPerTarget",

src/cfnlint/data/CloudSpecs/eu-north-1.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23254,6 +23254,18 @@
2325423254
"target"
2325523255
]
2325623256
},
23257+
"DocumentDBEngineVersion": {
23258+
"AllowedValues": [
23259+
"docdb"
23260+
]
23261+
},
23262+
"DocumentDBInstanceClass": {
23263+
"Ref": {
23264+
"Parameters": [
23265+
"String"
23266+
]
23267+
}
23268+
},
2325723269
"EC2ScalingPolicyPredifinedMetricSpecificationType": {
2325823270
"AllowedValues": [
2325923271
"ALBRequestCountPerTarget",

0 commit comments

Comments
 (0)