catocli 3.0.22__py3-none-any.whl → 3.0.25__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of catocli might be problematic. Click here for more details.

Files changed (161) hide show
  1. catocli/Utils/clidriver.py +2 -2
  2. catocli/Utils/formatter_app_stats.py +29 -16
  3. catocli/Utils/formatter_app_stats_timeseries.py +15 -23
  4. catocli/Utils/formatter_utils.py +1 -0
  5. catocli/__init__.py +1 -1
  6. catocli/parsers/customParserApiClient.py +6 -2
  7. catocli/parsers/query_appStatsTimeSeries/README.md +2 -0
  8. catocli/parsers/utils/export_utils.py +6 -2
  9. catocli-3.0.25.dist-info/METADATA +181 -0
  10. {catocli-3.0.22.dist-info → catocli-3.0.25.dist-info}/RECORD +160 -160
  11. models/mutation.policy.antiMalwareFileHash.addRule.json +0 -20
  12. models/mutation.policy.antiMalwareFileHash.addSection.json +0 -103
  13. models/mutation.policy.antiMalwareFileHash.createPolicyRevision.json +0 -123
  14. models/mutation.policy.antiMalwareFileHash.discardPolicyRevision.json +0 -123
  15. models/mutation.policy.antiMalwareFileHash.moveRule.json +0 -20
  16. models/mutation.policy.antiMalwareFileHash.moveSection.json +0 -103
  17. models/mutation.policy.antiMalwareFileHash.publishPolicyRevision.json +0 -123
  18. models/mutation.policy.antiMalwareFileHash.removeRule.json +0 -20
  19. models/mutation.policy.antiMalwareFileHash.removeSection.json +0 -103
  20. models/mutation.policy.antiMalwareFileHash.updatePolicy.json +0 -123
  21. models/mutation.policy.antiMalwareFileHash.updateRule.json +0 -20
  22. models/mutation.policy.antiMalwareFileHash.updateSection.json +0 -103
  23. models/mutation.policy.appTenantRestriction.addRule.json +0 -20
  24. models/mutation.policy.appTenantRestriction.addSection.json +0 -103
  25. models/mutation.policy.appTenantRestriction.createPolicyRevision.json +0 -123
  26. models/mutation.policy.appTenantRestriction.discardPolicyRevision.json +0 -123
  27. models/mutation.policy.appTenantRestriction.moveRule.json +0 -20
  28. models/mutation.policy.appTenantRestriction.moveSection.json +0 -103
  29. models/mutation.policy.appTenantRestriction.publishPolicyRevision.json +0 -123
  30. models/mutation.policy.appTenantRestriction.removeRule.json +0 -20
  31. models/mutation.policy.appTenantRestriction.removeSection.json +0 -103
  32. models/mutation.policy.appTenantRestriction.updatePolicy.json +0 -123
  33. models/mutation.policy.appTenantRestriction.updateRule.json +0 -20
  34. models/mutation.policy.appTenantRestriction.updateSection.json +0 -103
  35. models/mutation.policy.applicationControl.addRule.json +0 -20
  36. models/mutation.policy.applicationControl.addSection.json +0 -103
  37. models/mutation.policy.applicationControl.createPolicyRevision.json +0 -123
  38. models/mutation.policy.applicationControl.discardPolicyRevision.json +0 -123
  39. models/mutation.policy.applicationControl.moveRule.json +0 -20
  40. models/mutation.policy.applicationControl.moveSection.json +0 -103
  41. models/mutation.policy.applicationControl.publishPolicyRevision.json +0 -123
  42. models/mutation.policy.applicationControl.removeRule.json +0 -20
  43. models/mutation.policy.applicationControl.removeSection.json +0 -103
  44. models/mutation.policy.applicationControl.updatePolicy.json +0 -123
  45. models/mutation.policy.applicationControl.updateRule.json +0 -20
  46. models/mutation.policy.applicationControl.updateSection.json +0 -103
  47. models/mutation.policy.dynamicIpAllocation.addRule.json +0 -20
  48. models/mutation.policy.dynamicIpAllocation.addSection.json +0 -103
  49. models/mutation.policy.dynamicIpAllocation.createPolicyRevision.json +0 -123
  50. models/mutation.policy.dynamicIpAllocation.discardPolicyRevision.json +0 -123
  51. models/mutation.policy.dynamicIpAllocation.moveRule.json +0 -20
  52. models/mutation.policy.dynamicIpAllocation.moveSection.json +0 -103
  53. models/mutation.policy.dynamicIpAllocation.publishPolicyRevision.json +0 -123
  54. models/mutation.policy.dynamicIpAllocation.removeRule.json +0 -20
  55. models/mutation.policy.dynamicIpAllocation.removeSection.json +0 -103
  56. models/mutation.policy.dynamicIpAllocation.updatePolicy.json +0 -123
  57. models/mutation.policy.dynamicIpAllocation.updateRule.json +0 -20
  58. models/mutation.policy.dynamicIpAllocation.updateSection.json +0 -103
  59. models/mutation.policy.internetFirewall.addRule.json +0 -20
  60. models/mutation.policy.internetFirewall.addSection.json +0 -103
  61. models/mutation.policy.internetFirewall.createPolicyRevision.json +0 -123
  62. models/mutation.policy.internetFirewall.discardPolicyRevision.json +0 -123
  63. models/mutation.policy.internetFirewall.moveRule.json +0 -20
  64. models/mutation.policy.internetFirewall.moveSection.json +0 -103
  65. models/mutation.policy.internetFirewall.publishPolicyRevision.json +0 -123
  66. models/mutation.policy.internetFirewall.removeRule.json +0 -20
  67. models/mutation.policy.internetFirewall.removeSection.json +0 -103
  68. models/mutation.policy.internetFirewall.updatePolicy.json +0 -123
  69. models/mutation.policy.internetFirewall.updateRule.json +0 -20
  70. models/mutation.policy.internetFirewall.updateSection.json +0 -103
  71. models/mutation.policy.remotePortFwd.addRule.json +0 -20
  72. models/mutation.policy.remotePortFwd.addSection.json +0 -103
  73. models/mutation.policy.remotePortFwd.createPolicyRevision.json +0 -123
  74. models/mutation.policy.remotePortFwd.discardPolicyRevision.json +0 -123
  75. models/mutation.policy.remotePortFwd.moveRule.json +0 -20
  76. models/mutation.policy.remotePortFwd.moveSection.json +0 -103
  77. models/mutation.policy.remotePortFwd.publishPolicyRevision.json +0 -123
  78. models/mutation.policy.remotePortFwd.removeRule.json +0 -20
  79. models/mutation.policy.remotePortFwd.removeSection.json +0 -103
  80. models/mutation.policy.remotePortFwd.updatePolicy.json +0 -123
  81. models/mutation.policy.remotePortFwd.updateRule.json +0 -20
  82. models/mutation.policy.remotePortFwd.updateSection.json +0 -103
  83. models/mutation.policy.socketLan.addRule.json +0 -40
  84. models/mutation.policy.socketLan.addSection.json +0 -103
  85. models/mutation.policy.socketLan.createPolicyRevision.json +0 -143
  86. models/mutation.policy.socketLan.discardPolicyRevision.json +0 -143
  87. models/mutation.policy.socketLan.moveRule.json +0 -40
  88. models/mutation.policy.socketLan.moveSection.json +0 -103
  89. models/mutation.policy.socketLan.publishPolicyRevision.json +0 -143
  90. models/mutation.policy.socketLan.removeRule.json +0 -40
  91. models/mutation.policy.socketLan.removeSection.json +0 -103
  92. models/mutation.policy.socketLan.updatePolicy.json +0 -143
  93. models/mutation.policy.socketLan.updateRule.json +0 -40
  94. models/mutation.policy.socketLan.updateSection.json +0 -103
  95. models/mutation.policy.terminalServer.addRule.json +0 -20
  96. models/mutation.policy.terminalServer.addSection.json +0 -103
  97. models/mutation.policy.terminalServer.createPolicyRevision.json +0 -123
  98. models/mutation.policy.terminalServer.discardPolicyRevision.json +0 -123
  99. models/mutation.policy.terminalServer.moveRule.json +0 -20
  100. models/mutation.policy.terminalServer.moveSection.json +0 -103
  101. models/mutation.policy.terminalServer.publishPolicyRevision.json +0 -123
  102. models/mutation.policy.terminalServer.removeRule.json +0 -20
  103. models/mutation.policy.terminalServer.removeSection.json +0 -103
  104. models/mutation.policy.terminalServer.updatePolicy.json +0 -123
  105. models/mutation.policy.terminalServer.updateRule.json +0 -20
  106. models/mutation.policy.terminalServer.updateSection.json +0 -103
  107. models/mutation.policy.tlsInspect.addRule.json +0 -20
  108. models/mutation.policy.tlsInspect.addSection.json +0 -103
  109. models/mutation.policy.tlsInspect.createPolicyRevision.json +0 -123
  110. models/mutation.policy.tlsInspect.discardPolicyRevision.json +0 -123
  111. models/mutation.policy.tlsInspect.moveRule.json +0 -20
  112. models/mutation.policy.tlsInspect.moveSection.json +0 -103
  113. models/mutation.policy.tlsInspect.publishPolicyRevision.json +0 -123
  114. models/mutation.policy.tlsInspect.removeRule.json +0 -20
  115. models/mutation.policy.tlsInspect.removeSection.json +0 -103
  116. models/mutation.policy.tlsInspect.updatePolicy.json +0 -123
  117. models/mutation.policy.tlsInspect.updateRule.json +0 -20
  118. models/mutation.policy.tlsInspect.updateSection.json +0 -103
  119. models/mutation.policy.wanFirewall.addRule.json +0 -20
  120. models/mutation.policy.wanFirewall.addSection.json +0 -103
  121. models/mutation.policy.wanFirewall.createPolicyRevision.json +0 -123
  122. models/mutation.policy.wanFirewall.discardPolicyRevision.json +0 -123
  123. models/mutation.policy.wanFirewall.moveRule.json +0 -20
  124. models/mutation.policy.wanFirewall.moveSection.json +0 -103
  125. models/mutation.policy.wanFirewall.publishPolicyRevision.json +0 -123
  126. models/mutation.policy.wanFirewall.removeRule.json +0 -20
  127. models/mutation.policy.wanFirewall.removeSection.json +0 -103
  128. models/mutation.policy.wanFirewall.updatePolicy.json +0 -123
  129. models/mutation.policy.wanFirewall.updateRule.json +0 -20
  130. models/mutation.policy.wanFirewall.updateSection.json +0 -103
  131. models/mutation.policy.wanNetwork.addRule.json +0 -20
  132. models/mutation.policy.wanNetwork.addSection.json +0 -103
  133. models/mutation.policy.wanNetwork.createPolicyRevision.json +0 -123
  134. models/mutation.policy.wanNetwork.discardPolicyRevision.json +0 -123
  135. models/mutation.policy.wanNetwork.moveRule.json +0 -20
  136. models/mutation.policy.wanNetwork.moveSection.json +0 -103
  137. models/mutation.policy.wanNetwork.publishPolicyRevision.json +0 -123
  138. models/mutation.policy.wanNetwork.removeRule.json +0 -20
  139. models/mutation.policy.wanNetwork.removeSection.json +0 -103
  140. models/mutation.policy.wanNetwork.updatePolicy.json +0 -123
  141. models/mutation.policy.wanNetwork.updateRule.json +0 -20
  142. models/mutation.policy.wanNetwork.updateSection.json +0 -103
  143. models/query.appStats.json +216 -0
  144. models/query.appStatsTimeSeries.json +144 -0
  145. models/query.policy.antiMalwareFileHash.policy.json +0 -123
  146. models/query.policy.appTenantRestriction.policy.json +0 -123
  147. models/query.policy.applicationControl.policy.json +0 -123
  148. models/query.policy.dynamicIpAllocation.policy.json +0 -123
  149. models/query.policy.internetFirewall.policy.json +0 -123
  150. models/query.policy.remotePortFwd.policy.json +0 -123
  151. models/query.policy.socketLan.policy.json +0 -143
  152. models/query.policy.terminalServer.policy.json +0 -123
  153. models/query.policy.tlsInspect.policy.json +0 -123
  154. models/query.policy.wanFirewall.policy.json +0 -123
  155. models/query.policy.wanNetwork.policy.json +0 -123
  156. schema/catolib.py +64 -56
  157. catocli-3.0.22.dist-info/METADATA +0 -124
  158. {catocli-3.0.22.dist-info → catocli-3.0.25.dist-info}/WHEEL +0 -0
  159. {catocli-3.0.22.dist-info → catocli-3.0.25.dist-info}/entry_points.txt +0 -0
  160. {catocli-3.0.22.dist-info → catocli-3.0.25.dist-info}/licenses/LICENSE +0 -0
  161. {catocli-3.0.22.dist-info → catocli-3.0.25.dist-info}/top_level.txt +0 -0
@@ -7288,26 +7288,6 @@
7288
7288
  "non_null": false
7289
7289
  },
7290
7290
  "varName": "name"
7291
- },
7292
- "subPolicyId": {
7293
- "args": {},
7294
- "deprecationReason": null,
7295
- "description": null,
7296
- "id_str": "wanFirewall___policy___rules___rule___section___subPolicyId",
7297
- "isDeprecated": false,
7298
- "name": "subPolicyId",
7299
- "path": "wanFirewall.policy.rules.rule.section.subPolicyId",
7300
- "requestStr": "$subPolicyId:ID ",
7301
- "required": false,
7302
- "responseStr": "subPolicyId:$subPolicyId ",
7303
- "type": {
7304
- "kind": [
7305
- "SCALAR"
7306
- ],
7307
- "name": "ID",
7308
- "non_null": false
7309
- },
7310
- "varName": "subPolicyId"
7311
7291
  }
7312
7292
  },
7313
7293
  "inputFields": null,
@@ -9133,89 +9113,6 @@
9133
9113
  "description": null,
9134
9114
  "enumValues": null,
9135
9115
  "fields": {
9136
- "access": {
9137
- "args": {},
9138
- "deprecationReason": null,
9139
- "description": null,
9140
- "id_str": "wanFirewall___policy___sections___access",
9141
- "isDeprecated": false,
9142
- "name": "access",
9143
- "path": "wanFirewall.policy.sections.access",
9144
- "requestStr": "$entityAccess:EntityAccess ",
9145
- "required": false,
9146
- "responseStr": "access:$entityAccess ",
9147
- "type": {
9148
- "definition": {
9149
- "description": null,
9150
- "enumValues": null,
9151
- "fields": {
9152
- "action": {
9153
- "args": {},
9154
- "deprecationReason": null,
9155
- "description": null,
9156
- "id_str": "wanFirewall___policy___sections___access___action",
9157
- "isDeprecated": false,
9158
- "name": "action",
9159
- "path": "wanFirewall.policy.sections.access.action",
9160
- "requestStr": "$action:RBACAction! ",
9161
- "required": true,
9162
- "responseStr": "action:$action ",
9163
- "type": {
9164
- "definition": {
9165
- "description": null,
9166
- "enumValues": [
9167
- {
9168
- "deprecationReason": null,
9169
- "description": null,
9170
- "isDeprecated": false,
9171
- "name": "NONE"
9172
- },
9173
- {
9174
- "deprecationReason": null,
9175
- "description": null,
9176
- "isDeprecated": false,
9177
- "name": "VIEW"
9178
- },
9179
- {
9180
- "deprecationReason": null,
9181
- "description": null,
9182
- "isDeprecated": false,
9183
- "name": "EDIT"
9184
- }
9185
- ],
9186
- "fields": null,
9187
- "inputFields": null,
9188
- "interfaces": null,
9189
- "kind": "ENUM",
9190
- "name": "RBACAction",
9191
- "possibleTypes": null
9192
- },
9193
- "indexType": "enum",
9194
- "kind": [
9195
- "NON_NULL",
9196
- "ENUM"
9197
- ],
9198
- "name": "RBACAction",
9199
- "non_null": false
9200
- },
9201
- "varName": "action"
9202
- }
9203
- },
9204
- "inputFields": null,
9205
- "interfaces": [],
9206
- "kind": "OBJECT",
9207
- "name": "EntityAccess",
9208
- "possibleTypes": null
9209
- },
9210
- "indexType": "object",
9211
- "kind": [
9212
- "OBJECT"
9213
- ],
9214
- "name": "EntityAccess",
9215
- "non_null": false
9216
- },
9217
- "varName": "entityAccess"
9218
- },
9219
9116
  "audit": {
9220
9117
  "args": {},
9221
9118
  "deprecationReason": null,
@@ -9425,26 +9322,6 @@
9425
9322
  "non_null": false
9426
9323
  },
9427
9324
  "varName": "name"
9428
- },
9429
- "subPolicyId": {
9430
- "args": {},
9431
- "deprecationReason": null,
9432
- "description": null,
9433
- "id_str": "wanFirewall___policy___sections___section___subPolicyId",
9434
- "isDeprecated": false,
9435
- "name": "subPolicyId",
9436
- "path": "wanFirewall.policy.sections.section.subPolicyId",
9437
- "requestStr": "$subPolicyId:ID ",
9438
- "required": false,
9439
- "responseStr": "subPolicyId:$subPolicyId ",
9440
- "type": {
9441
- "kind": [
9442
- "SCALAR"
9443
- ],
9444
- "name": "ID",
9445
- "non_null": false
9446
- },
9447
- "varName": "subPolicyId"
9448
9325
  }
9449
9326
  },
9450
9327
  "inputFields": null,
@@ -6827,26 +6827,6 @@
6827
6827
  "non_null": false
6828
6828
  },
6829
6829
  "varName": "name"
6830
- },
6831
- "subPolicyId": {
6832
- "args": {},
6833
- "deprecationReason": null,
6834
- "description": null,
6835
- "id_str": "wanNetwork___policy___rules___rule___section___subPolicyId",
6836
- "isDeprecated": false,
6837
- "name": "subPolicyId",
6838
- "path": "wanNetwork.policy.rules.rule.section.subPolicyId",
6839
- "requestStr": "$subPolicyId:ID ",
6840
- "required": false,
6841
- "responseStr": "subPolicyId:$subPolicyId ",
6842
- "type": {
6843
- "kind": [
6844
- "SCALAR"
6845
- ],
6846
- "name": "ID",
6847
- "non_null": false
6848
- },
6849
- "varName": "subPolicyId"
6850
6830
  }
6851
6831
  },
6852
6832
  "inputFields": null,
@@ -7915,89 +7895,6 @@
7915
7895
  "description": null,
7916
7896
  "enumValues": null,
7917
7897
  "fields": {
7918
- "access": {
7919
- "args": {},
7920
- "deprecationReason": null,
7921
- "description": null,
7922
- "id_str": "wanNetwork___policy___sections___access",
7923
- "isDeprecated": false,
7924
- "name": "access",
7925
- "path": "wanNetwork.policy.sections.access",
7926
- "requestStr": "$entityAccess:EntityAccess ",
7927
- "required": false,
7928
- "responseStr": "access:$entityAccess ",
7929
- "type": {
7930
- "definition": {
7931
- "description": null,
7932
- "enumValues": null,
7933
- "fields": {
7934
- "action": {
7935
- "args": {},
7936
- "deprecationReason": null,
7937
- "description": null,
7938
- "id_str": "wanNetwork___policy___sections___access___action",
7939
- "isDeprecated": false,
7940
- "name": "action",
7941
- "path": "wanNetwork.policy.sections.access.action",
7942
- "requestStr": "$action:RBACAction! ",
7943
- "required": true,
7944
- "responseStr": "action:$action ",
7945
- "type": {
7946
- "definition": {
7947
- "description": null,
7948
- "enumValues": [
7949
- {
7950
- "deprecationReason": null,
7951
- "description": null,
7952
- "isDeprecated": false,
7953
- "name": "NONE"
7954
- },
7955
- {
7956
- "deprecationReason": null,
7957
- "description": null,
7958
- "isDeprecated": false,
7959
- "name": "VIEW"
7960
- },
7961
- {
7962
- "deprecationReason": null,
7963
- "description": null,
7964
- "isDeprecated": false,
7965
- "name": "EDIT"
7966
- }
7967
- ],
7968
- "fields": null,
7969
- "inputFields": null,
7970
- "interfaces": null,
7971
- "kind": "ENUM",
7972
- "name": "RBACAction",
7973
- "possibleTypes": null
7974
- },
7975
- "indexType": "enum",
7976
- "kind": [
7977
- "NON_NULL",
7978
- "ENUM"
7979
- ],
7980
- "name": "RBACAction",
7981
- "non_null": false
7982
- },
7983
- "varName": "action"
7984
- }
7985
- },
7986
- "inputFields": null,
7987
- "interfaces": [],
7988
- "kind": "OBJECT",
7989
- "name": "EntityAccess",
7990
- "possibleTypes": null
7991
- },
7992
- "indexType": "object",
7993
- "kind": [
7994
- "OBJECT"
7995
- ],
7996
- "name": "EntityAccess",
7997
- "non_null": false
7998
- },
7999
- "varName": "entityAccess"
8000
- },
8001
7898
  "audit": {
8002
7899
  "args": {},
8003
7900
  "deprecationReason": null,
@@ -8207,26 +8104,6 @@
8207
8104
  "non_null": false
8208
8105
  },
8209
8106
  "varName": "name"
8210
- },
8211
- "subPolicyId": {
8212
- "args": {},
8213
- "deprecationReason": null,
8214
- "description": null,
8215
- "id_str": "wanNetwork___policy___sections___section___subPolicyId",
8216
- "isDeprecated": false,
8217
- "name": "subPolicyId",
8218
- "path": "wanNetwork.policy.sections.section.subPolicyId",
8219
- "requestStr": "$subPolicyId:ID ",
8220
- "required": false,
8221
- "responseStr": "subPolicyId:$subPolicyId ",
8222
- "type": {
8223
- "kind": [
8224
- "SCALAR"
8225
- ],
8226
- "name": "ID",
8227
- "non_null": false
8228
- },
8229
- "varName": "subPolicyId"
8230
8107
  }
8231
8108
  },
8232
8109
  "inputFields": null,
schema/catolib.py CHANGED
@@ -256,8 +256,8 @@ def processOperation(operationType, operationName):
256
256
 
257
257
  childOperations = operation_data.get("childOperations", {}).keys() if "childOperations" in operation_data else []
258
258
 
259
- # Process with recursion depth tracking
260
- parsedOperation = parseOperationWithDepthTracking(operation_data, childOperations, max_depth=50)
259
+ # Process with recursion depth tracking and pass operation name for filtering
260
+ parsedOperation = parseOperationWithDepthTracking(operation_data, childOperations, max_depth=50, operation_path=operationName)
261
261
  parsedOperation = getOperationArgs(parsedOperation["type"]["definition"], parsedOperation)
262
262
  parsedOperation["path"] = operationName
263
263
 
@@ -313,7 +313,7 @@ def processOperation(operationType, operationName):
313
313
  print(f"Error in processOperation {operationName}: {e}")
314
314
  raise
315
315
 
316
- def parseOperationWithDepthTracking(curOperation, childOperations, max_depth=50):
316
+ def parseOperationWithDepthTracking(curOperation, childOperations, max_depth=50, operation_path=None):
317
317
  """Parse operation with recursion depth tracking to prevent stack overflow"""
318
318
  if not hasattr(thread_local, 'depth'):
319
319
  thread_local.depth = 0
@@ -325,7 +325,7 @@ def parseOperationWithDepthTracking(curOperation, childOperations, max_depth=50)
325
325
  print(f"WARNING: Max recursion depth {max_depth} reached, truncating...")
326
326
  return curOperation
327
327
 
328
- return parseOperation(curOperation, childOperations)
328
+ return parseOperation(curOperation, childOperations, operation_path)
329
329
  finally:
330
330
  thread_local.depth -= 1
331
331
 
@@ -405,7 +405,7 @@ def getNestedArgDefinitions(argsAry, parentParamPath, childOperations, parentFie
405
405
  newArgsList[arg["id_str"]] = arg
406
406
  return newArgsList
407
407
 
408
- def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperations, parentFields):
408
+ def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperations, parentFields, operation_path=None):
409
409
  """Thread-safe version of interface definitions processing"""
410
410
  curInterfaces = {}
411
411
  for possibleType in possibleTypesAry:
@@ -416,13 +416,13 @@ def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperat
416
416
  curInterface = curInterfaces[interfaceName]
417
417
  curParamPath = "" if (parentParamPath == None) else parentParamPath + curInterface["name"] + "___"
418
418
  if "fields" in curInterface and curInterface["fields"] != None and curInterface["name"] != "CatoEndpointUser":
419
- curInterface["fields"] = getNestedFieldDefinitions(copy.deepcopy(curInterface["fields"]), curParamPath, childOperations, parentFields, curInterface["name"])
419
+ curInterface["fields"] = getNestedFieldDefinitions(copy.deepcopy(curInterface["fields"]), curParamPath, childOperations, parentFields, curInterface["name"], operation_path)
420
420
  if "inputFields" in curInterface and curInterface["inputFields"] != None:
421
- curInterface["inputFields"] = getNestedFieldDefinitions(copy.deepcopy(curInterface["inputFields"]), curParamPath, childOperations, parentFields, curInterface["name"])
421
+ curInterface["inputFields"] = getNestedFieldDefinitions(copy.deepcopy(curInterface["inputFields"]), curParamPath, childOperations, parentFields, curInterface["name"], operation_path)
422
422
  if "interfaces" in curInterface and curInterface["interfaces"] != None:
423
- curInterface["interfaces"] = getNestedInterfaceDefinitions(copy.deepcopy(curInterface["interfaces"]), parentParamPath, childOperations, parentFields)
423
+ curInterface["interfaces"] = getNestedInterfaceDefinitions(copy.deepcopy(curInterface["interfaces"]), parentParamPath, childOperations, parentFields, operation_path)
424
424
  if "possibleTypes" in curInterface and curInterface["possibleTypes"] != None:
425
- curInterface["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(curInterface["possibleTypes"]), parentParamPath, childOperations, parentFields)
425
+ curInterface["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(curInterface["possibleTypes"]), parentParamPath, childOperations, parentFields, operation_path)
426
426
 
427
427
  return curInterfaces
428
428
 
@@ -1197,7 +1197,7 @@ catocli {operationCmd} '{example_json_pretty}'
1197
1197
 
1198
1198
  print(" - README files written successfully")
1199
1199
 
1200
- def getOfType(curType, ofType, parentParamPath, childOperations, parentFields, parentTypeName=None):
1200
+ def getOfType(curType, ofType, parentParamPath, childOperations, parentFields, parentTypeName=None, operation_path=None):
1201
1201
  """Thread-safe version with recursion depth management"""
1202
1202
  if not hasattr(thread_local, 'depth'):
1203
1203
  thread_local.depth = 0
@@ -1213,7 +1213,7 @@ def getOfType(curType, ofType, parentParamPath, childOperations, parentFields, p
1213
1213
  curParamPath = "" if (parentParamPath == None) else parentParamPath + "___"
1214
1214
 
1215
1215
  if curType["ofType"] != None:
1216
- ofType = getOfType(copy.deepcopy(curType["ofType"]), ofType, parentParamPath, childOperations, parentFields)
1216
+ ofType = getOfType(copy.deepcopy(curType["ofType"]), ofType, parentParamPath, childOperations, parentFields, parentTypeName, operation_path)
1217
1217
  else:
1218
1218
  ofType["name"] = curType["name"]
1219
1219
 
@@ -1227,28 +1227,28 @@ def getOfType(curType, ofType, parentParamPath, childOperations, parentFields, p
1227
1227
  ofType["indexType"] = "input_object"
1228
1228
  ofType["definition"] = copy.deepcopy(catoApiIntrospection["input_objects"][ofType["name"]])
1229
1229
  if ofType["definition"]["inputFields"] != None:
1230
- ofType["definition"]["inputFields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["inputFields"]), curParamPath, childOperations, parentFields, ofType["name"])
1230
+ ofType["definition"]["inputFields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["inputFields"]), curParamPath, childOperations, parentFields, ofType["name"], operation_path)
1231
1231
  elif "UNION" in ofType["kind"]:
1232
1232
  ofType["indexType"] = "interface"
1233
1233
  ofType["definition"] = copy.deepcopy(catoApiIntrospection["unions"][ofType["name"]])
1234
1234
  if ofType["definition"]["possibleTypes"] != None:
1235
- ofType["definition"]["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["possibleTypes"]), curParamPath, childOperations, parentFields)
1235
+ ofType["definition"]["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["possibleTypes"]), curParamPath, childOperations, parentFields, operation_path)
1236
1236
  elif "OBJECT" in ofType["kind"]:
1237
1237
  ofType["indexType"] = "object"
1238
1238
  ofType["definition"] = copy.deepcopy(catoApiIntrospection["objects"][ofType["name"]])
1239
1239
  if ofType["definition"]["fields"] != None and childOperations!=None:
1240
1240
  ofType["definition"]["fields"] = checkForChildOperation(copy.deepcopy(ofType["definition"]["fields"]), childOperations)
1241
- ofType["definition"]["fields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["fields"]), curParamPath, childOperations, parentFields, ofType["name"])
1241
+ ofType["definition"]["fields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["fields"]), curParamPath, childOperations, parentFields, ofType["name"], operation_path)
1242
1242
  if ofType["definition"]["interfaces"] != None:
1243
- ofType["definition"]["interfaces"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["interfaces"]), curParamPath, childOperations, parentFields)
1243
+ ofType["definition"]["interfaces"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["interfaces"]), curParamPath, childOperations, parentFields, operation_path)
1244
1244
  elif "INTERFACE" in ofType["kind"]:
1245
1245
  ofType["indexType"] = "interface"
1246
1246
  ofType["definition"] = copy.deepcopy(catoApiIntrospection["interfaces"][ofType["name"]])
1247
1247
  if ofType["definition"]["fields"] != None:
1248
- ofType["definition"]["fields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["fields"]), curParamPath, childOperations, parentFields, ofType["name"])
1248
+ ofType["definition"]["fields"] = getNestedFieldDefinitions(copy.deepcopy(ofType["definition"]["fields"]), curParamPath, childOperations, parentFields, ofType["name"], operation_path)
1249
1249
  # CRITICAL FIX: Also handle possibleTypes for interfaces (like MergedIncident)
1250
1250
  if ofType["definition"]["possibleTypes"] != None:
1251
- ofType["definition"]["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["possibleTypes"]), curParamPath, childOperations, parentFields)
1251
+ ofType["definition"]["possibleTypes"] = getNestedInterfaceDefinitions(copy.deepcopy(ofType["definition"]["possibleTypes"]), curParamPath, childOperations, parentFields, operation_path)
1252
1252
  elif "ENUM" in ofType["kind"]:
1253
1253
  ofType["indexType"] = "enum"
1254
1254
  ofType["definition"] = copy.deepcopy(catoApiIntrospection["enums"][ofType["name"]])
@@ -1257,17 +1257,54 @@ def getOfType(curType, ofType, parentParamPath, childOperations, parentFields, p
1257
1257
  finally:
1258
1258
  thread_local.depth -= 1
1259
1259
 
1260
- def getNestedFieldDefinitions(fieldsAry, parentParamPath, childOperations, parentFields, parentTypeName=None):
1261
- """Thread-safe version with FIXED records exclusion removal"""
1260
+ def should_exclude_field(field_name, field_type, operation_path, parent_path):
1261
+ """
1262
+ Determine if a field should be excluded from model generation for query.policy and mutation.policy operations.
1263
+
1264
+ Excludes:
1265
+ - subPolicyId field (type: ID) from rules.rule.section and sections.section
1266
+ - access field from sections with EntityAccess type containing action field (enum: RBACAction)
1267
+ """
1268
+ # Only apply filtering to query.policy and mutation.policy operations
1269
+ if not operation_path or not (operation_path.startswith("query.policy") or operation_path.startswith("mutation.policy")):
1270
+ return False
1271
+
1272
+ # Exclude subPolicyId field from specific sections (handles nested paths like firewall.rule.section)
1273
+ if (field_name == "subPolicyId" and
1274
+ field_type.get("name") == "ID" and
1275
+ parent_path and (
1276
+ parent_path.endswith(".section.subPolicyId") and
1277
+ ("rules.rule" in parent_path or "sections.section" in parent_path or
1278
+ "rule.rule.section" in parent_path or # For mutations like addRule.rule.rule.section
1279
+ "section.section" in parent_path or # For mutations like addSection.section.section
1280
+ "firewall.rule.section" in parent_path) # For socketLan mutations like addRule.rule.rule.firewall.rule.section
1281
+ )):
1282
+ return True
1283
+
1284
+ # Exclude access field from sections with EntityAccess type
1285
+ if (field_name == "access" and
1286
+ field_type.get("name") == "EntityAccess" and
1287
+ parent_path and ("sections.access" in parent_path or
1288
+ parent_path.endswith(".access") and "section" in parent_path)):
1289
+ return True
1290
+
1291
+ return False
1292
+
1293
+ def getNestedFieldDefinitions(fieldsAry, parentParamPath, childOperations, parentFields, parentTypeName=None, operation_path=None):
1294
+ """Thread-safe version with field exclusion logic for policy operations"""
1262
1295
  newFieldsList = {}
1263
1296
  for field in fieldsAry:
1264
1297
  if isinstance(field, str):
1265
1298
  field = fieldsAry[field]
1266
1299
  curParamPath = field["name"] if (parentParamPath == None) else (parentParamPath.replace("___",".") + field["name"])
1267
- field["type"] = getOfType(field["type"], { "non_null": False, "kind": [], "name": None }, curParamPath, childOperations, parentFields, parentTypeName)
1300
+ field["type"] = getOfType(field["type"], { "non_null": False, "kind": [], "name": None }, curParamPath, childOperations, parentFields, parentTypeName, operation_path)
1268
1301
  field["path"] = curParamPath
1269
1302
  field["id_str"] = curParamPath.replace(".","___")
1270
1303
 
1304
+ # Check if this field should be excluded from policy operations
1305
+ if should_exclude_field(field["name"], field["type"], operation_path, curParamPath):
1306
+ continue # Skip this field
1307
+
1271
1308
  if isinstance(field["type"]["kind"], list):
1272
1309
  field["required"] = True if field["type"]["kind"][0] == "NON_NULL" else False
1273
1310
  else:
@@ -1333,21 +1370,21 @@ def send(api_key, query, variables={}, operationName=None):
1333
1370
  # writeCliDriver, writeOperationParsers, writeReadmes, etc.)
1334
1371
  # For space reasons, I'm not including them all here, but they should be copied over
1335
1372
 
1336
- def parseOperation(curOperation, childOperations):
1373
+ def parseOperation(curOperation, childOperations, operation_path=None):
1337
1374
  if "operationArgs" not in curOperation:
1338
1375
  curOperation["operationArgs"] = {}
1339
1376
  curOperation["fieldTypes"] = {}
1340
- curOfType = getOfType(curOperation["type"], { "non_null": False, "kind": [], "name": None }, None, childOperations, None)
1377
+ curOfType = getOfType(curOperation["type"], { "non_null": False, "kind": [], "name": None }, None, childOperations, None, None, operation_path)
1341
1378
  curOperation["type"] = copy.deepcopy(curOfType)
1342
1379
  if curOfType["name"] in catoApiIntrospection["objects"]:
1343
1380
  curOperation["args"] = getNestedArgDefinitions(curOperation["args"], None, childOperations, None)
1344
1381
  curOperation["type"]["definition"] = copy.deepcopy(catoApiIntrospection["objects"][curOperation["type"]["name"]])
1345
1382
  if "fields" in curOperation["type"]["definition"] and curOperation["type"]["definition"]["fields"] != None:
1346
1383
  curOperation["type"]["definition"]["fields"] = checkForChildOperation(copy.deepcopy(curOperation["type"]["definition"]["fields"]), childOperations)
1347
- curOperation["type"]["definition"]["fields"] = copy.deepcopy(getNestedFieldDefinitions(curOperation["type"]["definition"]["fields"], None, childOperations, [], curOperation["type"]["name"]))
1384
+ curOperation["type"]["definition"]["fields"] = copy.deepcopy(getNestedFieldDefinitions(curOperation["type"]["definition"]["fields"], None, childOperations, [], curOperation["type"]["name"], operation_path))
1348
1385
  if "inputFields" in curOperation["type"]["definition"] and curOperation["type"]["definition"]["inputFields"] != None:
1349
1386
  parentFields = curOperation["type"]["definition"]["inputFields"].keys()
1350
- curOperation["type"]["definition"]["inputFields"] = copy.deepcopy(getNestedFieldDefinitions(curOperation["type"]["definition"]["inputFields"], None, childOperations, parentFields, curOperation["type"]["name"]))
1387
+ curOperation["type"]["definition"]["inputFields"] = copy.deepcopy(getNestedFieldDefinitions(curOperation["type"]["definition"]["inputFields"], None, childOperations, parentFields, curOperation["type"]["name"], operation_path))
1351
1388
  return curOperation
1352
1389
 
1353
1390
  def checkForChildOperation(fieldsAry, childOperations):
@@ -1472,7 +1509,7 @@ def renderInputFieldVal(arg):
1472
1509
 
1473
1510
  return value
1474
1511
 
1475
- def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperations, parentFields):
1512
+ def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperations, parentFields, operation_path=None):
1476
1513
  """Get nested interface definitions - returns expanded possibleTypes array with complete field definitions"""
1477
1514
  expandedTypes = []
1478
1515
  for possibleType in possibleTypesAry:
@@ -1489,7 +1526,8 @@ def getNestedInterfaceDefinitions(possibleTypesAry, parentParamPath, childOperat
1489
1526
  parentParamPath,
1490
1527
  childOperations,
1491
1528
  parentFields,
1492
- possibleType["name"]
1529
+ possibleType["name"],
1530
+ operation_path
1493
1531
  )
1494
1532
  expandedTypes.append(expandedType)
1495
1533
  else:
@@ -1717,33 +1755,3 @@ catocli {subOperationCmd} '{example_json_pretty}'
1717
1755
  # Only recurse if subOperation is a dict and doesn't have a "path" key
1718
1756
  if isinstance(subOperation, dict) and "path" not in subOperation:
1719
1757
  renderSubReadme(subOperation, operationType, subOperationPath)
1720
-
1721
- def main():
1722
- # Main execution function with threading support
1723
- options = initParser()
1724
-
1725
- # Load the introspection schema
1726
- print("Loading schema...")
1727
- schema = loadJSON("./introspection.json")
1728
-
1729
- print("Starting multi-threaded schema parsing...")
1730
- start_time = time.time()
1731
-
1732
- # Parse the schema using multi-threading
1733
- parseSchema(schema)
1734
-
1735
- end_time = time.time()
1736
- print(f"\n• Schema processing completed in {end_time - start_time:.2f} seconds")
1737
-
1738
- print("\n• Generating CLI components...")
1739
- writeCliDriver(catoApiSchema)
1740
- writeOperationParsers(catoApiSchema)
1741
- writeReadmes(catoApiSchema)
1742
-
1743
- total_operations = len(catoApiSchema["query"]) + len(catoApiSchema["mutation"])
1744
- print(f"\n• Successfully generated {total_operations} operation models")
1745
- print(f" - Query operations: {len(catoApiSchema['query'])}")
1746
- print(f" - Mutation operations: {len(catoApiSchema['mutation'])}")
1747
-
1748
- if __name__ == "__main__":
1749
- main()