16
16
17
17
from contentctl .output .json_writer import JsonWriter
18
18
19
+ JSON_API_VERSION = 2
20
+
19
21
20
22
class ApiJsonOutput :
21
23
output_path : pathlib .Path
@@ -70,7 +72,9 @@ def writeDetections(
70
72
# del()
71
73
72
74
JsonWriter .writeJsonObject (
73
- os .path .join (self .output_path , "detections.json" ), "detections" , detections
75
+ os .path .join (self .output_path , f"detections_v{ JSON_API_VERSION } .json" ),
76
+ "detections" ,
77
+ detections ,
74
78
)
75
79
76
80
def writeMacros (
@@ -86,7 +90,9 @@ def writeMacros(
86
90
if k in macro :
87
91
del macro [k ]
88
92
JsonWriter .writeJsonObject (
89
- os .path .join (self .output_path , "macros.json" ), "macros" , macros
93
+ os .path .join (self .output_path , f"macros_v{ JSON_API_VERSION } .json" ),
94
+ "macros" ,
95
+ macros ,
90
96
)
91
97
92
98
def writeStories (
@@ -132,7 +138,9 @@ def writeStories(
132
138
]
133
139
134
140
JsonWriter .writeJsonObject (
135
- os .path .join (self .output_path , "stories.json" ), "stories" , stories
141
+ os .path .join (self .output_path , f"stories_v{ JSON_API_VERSION } .json" ),
142
+ "stories" ,
143
+ stories ,
136
144
)
137
145
138
146
def writeBaselines (
@@ -163,7 +171,9 @@ def writeBaselines(
163
171
]
164
172
165
173
JsonWriter .writeJsonObject (
166
- os .path .join (self .output_path , "baselines.json" ), "baselines" , baselines
174
+ os .path .join (self .output_path , f"baselines_v{ JSON_API_VERSION } .json" ),
175
+ "baselines" ,
176
+ baselines ,
167
177
)
168
178
169
179
def writeInvestigations (
@@ -195,7 +205,7 @@ def writeInvestigations(
195
205
for investigation in objects
196
206
]
197
207
JsonWriter .writeJsonObject (
198
- os .path .join (self .output_path , "response_tasks .json" ),
208
+ os .path .join (self .output_path , f"response_tasks_v { JSON_API_VERSION } .json" ),
199
209
"response_tasks" ,
200
210
investigations ,
201
211
)
@@ -227,7 +237,9 @@ def writeLookups(
227
237
if k in lookup :
228
238
del lookup [k ]
229
239
JsonWriter .writeJsonObject (
230
- os .path .join (self .output_path , "lookups.json" ), "lookups" , lookups
240
+ os .path .join (self .output_path , f"lookups_v{ JSON_API_VERSION } .json" ),
241
+ "lookups" ,
242
+ lookups ,
231
243
)
232
244
233
245
def writeDeployments (
@@ -255,7 +267,7 @@ def writeDeployments(
255
267
# references are not to be included, but have been deleted in the
256
268
# model_serialization logic
257
269
JsonWriter .writeJsonObject (
258
- os .path .join (self .output_path , "deployments .json" ),
270
+ os .path .join (self .output_path , f"deployments_v { JSON_API_VERSION } .json" ),
259
271
"deployments" ,
260
272
deployments ,
261
273
)
0 commit comments