@@ -41,6 +41,35 @@ def prune_properties(document, paths):
41
41
return document
42
42
43
43
44
+ def prune_properties_if_not_exist_in_path (output_model , input_model , paths ):
45
+ """Prune given properties from a document.
46
+
47
+ This assumes properties will always have an object (dict) as a parent.
48
+ The function returns the document after pruning the path which exists
49
+ in the paths tuple but not in the input_model
50
+ """
51
+ output_document = {"properties" : output_model .copy ()}
52
+ input_document = {"properties" : input_model .copy ()}
53
+ for path in paths :
54
+ try :
55
+ if not path_exists (input_document , path ):
56
+ _prop , resolved_path , parent = traverse (output_document , path )
57
+ key = resolved_path [- 1 ]
58
+ del parent [key ]
59
+ except LookupError :
60
+ pass
61
+ return output_document ["properties" ]
62
+
63
+
64
+ def path_exists (document , path ):
65
+ try :
66
+ _prop , _resolved_path , _parent = traverse (document , path )
67
+ except LookupError :
68
+ return False
69
+ else :
70
+ return True
71
+
72
+
44
73
def prune_properties_from_model (model , paths ):
45
74
"""Prune given properties from a resource model.
46
75
@@ -299,7 +328,7 @@ def make_request(
299
328
return {
300
329
"desiredResourceState" : desired_resource_state ,
301
330
"previousResourceState" : previous_resource_state ,
302
- "logicalResourceIdentifier" : None ,
331
+ "logicalResourceIdentifier" : "test" ,
303
332
** kwargs ,
304
333
"region" : region ,
305
334
"awsPartition" : partition ,
0 commit comments