@@ -142,7 +142,6 @@ def resource_vpc_schema():
142
142
143
143
144
144
def test_vpc_schema (resource_vpc_schema ):
145
-
146
145
schema = Schema (schema = resource_vpc_schema )
147
146
assert list (schema .get_atts .keys ()) == [
148
147
"CidrBlock" ,
@@ -161,3 +160,155 @@ def test_vpc_schema(resource_vpc_schema):
161
160
assert schema .get_atts ["VpcId" ] == "/properties/VpcId"
162
161
assert schema .get_atts ["CidrBlock" ] == "/properties/CidrBlock"
163
162
assert schema .get_atts ["Ipv6CidrBlocks" ] == "/properties/Ipv6CidrBlocks"
163
+
164
+
165
+ @pytest .fixture
166
+ def resource_servicecatalog_schema ():
167
+ return {
168
+ "additionalProperties" : False ,
169
+ "createOnlyProperties" : [
170
+ "/properties/NotificationArns" ,
171
+ "/properties/ProvisionedProductName" ,
172
+ ],
173
+ "definitions" : {
174
+ "OutputType" : {"type" : "string" },
175
+ "ProvisioningParameter" : {
176
+ "additionalProperties" : False ,
177
+ "properties" : {
178
+ "Key" : {"maxLength" : 1000 , "minLength" : 1 , "type" : "string" },
179
+ "Value" : {"maxLength" : 4096 , "type" : "string" },
180
+ },
181
+ "required" : ["Key" , "Value" ],
182
+ "type" : "object" ,
183
+ },
184
+ "ProvisioningPreferences" : {
185
+ "additionalProperties" : False ,
186
+ "properties" : {
187
+ "StackSetAccounts" : {
188
+ "items" : {"pattern" : "^[0-9]{12}$" , "type" : "string" },
189
+ "type" : "array" ,
190
+ "uniqueItems" : True ,
191
+ },
192
+ "StackSetFailureToleranceCount" : {"minimum" : 0 , "type" : "integer" },
193
+ "StackSetFailureTolerancePercentage" : {
194
+ "maximum" : 100 ,
195
+ "minimum" : 0 ,
196
+ "type" : "integer" ,
197
+ },
198
+ "StackSetMaxConcurrencyCount" : {"minimum" : 1 , "type" : "integer" },
199
+ "StackSetMaxConcurrencyPercentage" : {
200
+ "maximum" : 100 ,
201
+ "minimum" : 1 ,
202
+ "type" : "integer" ,
203
+ },
204
+ "StackSetOperationType" : {
205
+ "enum" : ["CREATE" , "UPDATE" , "DELETE" ],
206
+ "type" : "string" ,
207
+ },
208
+ "StackSetRegions" : {
209
+ "items" : {
210
+ "pattern" : "^[a-z]{2}-([a-z]+-)+[1-9]" ,
211
+ "type" : "string" ,
212
+ },
213
+ "type" : "array" ,
214
+ "uniqueItems" : True ,
215
+ },
216
+ },
217
+ "type" : "object" ,
218
+ },
219
+ "Tag" : {
220
+ "additionalProperties" : False ,
221
+ "properties" : {
222
+ "Key" : {
223
+ "maxLength" : 128 ,
224
+ "minLength" : 1 ,
225
+ "pattern" : "^([\\ p{L}\\ p{Z}\\ p{N}_.:/=+\\ -@]*)$" ,
226
+ "type" : "string" ,
227
+ },
228
+ "Value" : {
229
+ "maxLength" : 256 ,
230
+ "minLength" : 1 ,
231
+ "pattern" : "^([\\ p{L}\\ p{Z}\\ p{N}_.:/=+\\ -@]*)$" ,
232
+ "type" : "string" ,
233
+ },
234
+ },
235
+ "required" : ["Key" , "Value" ],
236
+ "type" : "object" ,
237
+ },
238
+ },
239
+ "documentationUrl" : "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html" ,
240
+ "handlers" : {
241
+ "create" : {"permissions" : ["*" ], "timeoutInMinutes" : 720 },
242
+ "delete" : {"permissions" : ["*" ]},
243
+ "read" : {"permissions" : ["*" ]},
244
+ "update" : {"permissions" : ["*" ], "timeoutInMinutes" : 720 },
245
+ },
246
+ "primaryIdentifier" : ["/properties/ProvisionedProductId" ],
247
+ "properties" : {
248
+ "AcceptLanguage" : {"enum" : ["en" , "jp" , "zh" ], "type" : "string" },
249
+ "CloudformationStackArn" : {
250
+ "maxLength" : 256 ,
251
+ "minLength" : 1 ,
252
+ "type" : "string" ,
253
+ },
254
+ "NotificationArns" : {
255
+ "items" : {"type" : "string" },
256
+ "maxItems" : 5 ,
257
+ "type" : "array" ,
258
+ "uniqueItems" : True ,
259
+ },
260
+ "Outputs" : {
261
+ "additionalProperties" : False ,
262
+ "maxProperties" : 100 ,
263
+ "patternProperties" : {
264
+ "^[A-Za-z0-9]{1,64}$" : {"$ref" : "#/definitions/OutputType" }
265
+ },
266
+ "type" : "object" ,
267
+ },
268
+ "PathId" : {"maxLength" : 100 , "minLength" : 1 , "type" : "string" },
269
+ "PathName" : {"maxLength" : 100 , "minLength" : 1 , "type" : "string" },
270
+ "ProductId" : {"maxLength" : 100 , "minLength" : 1 , "type" : "string" },
271
+ "ProductName" : {"maxLength" : 128 , "minLength" : 1 , "type" : "string" },
272
+ "ProvisionedProductId" : {"maxLength" : 50 , "minLength" : 1 , "type" : "string" },
273
+ "ProvisionedProductName" : {
274
+ "maxLength" : 128 ,
275
+ "minLength" : 1 ,
276
+ "type" : "string" ,
277
+ },
278
+ "ProvisioningArtifactId" : {
279
+ "maxLength" : 100 ,
280
+ "minLength" : 1 ,
281
+ "type" : "string" ,
282
+ },
283
+ "ProvisioningArtifactName" : {"type" : "string" },
284
+ "ProvisioningParameters" : {
285
+ "items" : {"$ref" : "#/definitions/ProvisioningParameter" },
286
+ "type" : "array" ,
287
+ },
288
+ "ProvisioningPreferences" : {
289
+ "$ref" : "#/definitions/ProvisioningPreferences"
290
+ },
291
+ "RecordId" : {"maxLength" : 50 , "minLength" : 1 , "type" : "string" },
292
+ "Tags" : {"items" : {"$ref" : "#/definitions/Tag" }, "type" : "array" },
293
+ },
294
+ "readOnlyProperties" : [
295
+ "/properties/RecordId" ,
296
+ "/properties/CloudformationStackArn" ,
297
+ "/properties/Outputs" ,
298
+ "/properties/ProvisionedProductId" ,
299
+ ],
300
+ "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git" ,
301
+ "typeName" : "AWS::ServiceCatalog::CloudFormationProvisionedProduct" ,
302
+ }
303
+
304
+
305
+ def test_servicecatalog_cloudformation_schema (resource_servicecatalog_schema ):
306
+
307
+ schema = Schema (schema = resource_servicecatalog_schema )
308
+ assert list (schema .get_atts .keys ()) == [
309
+ "RecordId" ,
310
+ "CloudformationStackArn" ,
311
+ "Outputs\\ ..*" ,
312
+ "ProvisionedProductId" ,
313
+ ]
314
+ assert schema .get_atts ["Outputs.Example" ] == "/properties/CfnLintStringType"
0 commit comments