js7-client-python 2.0.1__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.
Files changed (389) hide show
  1. js7/__init__.py +8 -0
  2. js7/api/joc/http/v_2_8_2/agent/cluster/confirm_node_loss.py +36 -0
  3. js7/api/joc/http/v_2_8_2/agent/cluster/switchover.py +36 -0
  4. js7/api/joc/http/v_2_8_2/agent/delete.py +36 -0
  5. js7/api/joc/http/v_2_8_2/agents/agents.py +36 -0
  6. js7/api/joc/http/v_2_8_2/agents/cluster/delete.py +36 -0
  7. js7/api/joc/http/v_2_8_2/agents/cluster/deploy.py +36 -0
  8. js7/api/joc/http/v_2_8_2/agents/cluster/revoke.py +36 -0
  9. js7/api/joc/http/v_2_8_2/agents/cluster/store.py +36 -0
  10. js7/api/joc/http/v_2_8_2/agents/export.py +36 -0
  11. js7/api/joc/http/v_2_8_2/agents/import.py +74 -0
  12. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/deploy.py +36 -0
  13. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/revoke.py +36 -0
  14. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/store.py +36 -0
  15. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/subagents/delete.py +36 -0
  16. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/subagents/disable.py +36 -0
  17. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/subagents/enable.py +36 -0
  18. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/subagents/reset.py +36 -0
  19. js7/api/joc/http/v_2_8_2/agents/inventory/cluster/subagents/store.py +36 -0
  20. js7/api/joc/http/v_2_8_2/agents/inventory/deploy.py +36 -0
  21. js7/api/joc/http/v_2_8_2/agents/inventory/disable.py +36 -0
  22. js7/api/joc/http/v_2_8_2/agents/inventory/enable.py +36 -0
  23. js7/api/joc/http/v_2_8_2/agents/inventory/revoke.py +36 -0
  24. js7/api/joc/http/v_2_8_2/agents/inventory/store.py +36 -0
  25. js7/api/joc/http/v_2_8_2/agents/reset.py +36 -0
  26. js7/api/joc/http/v_2_8_2/authentication/auth.py +32 -0
  27. js7/api/joc/http/v_2_8_2/authentication/joc_cockpit_permissions.py +28 -0
  28. js7/api/joc/http/v_2_8_2/authentication/login.py +35 -0
  29. js7/api/joc/http/v_2_8_2/authentication/logout.py +28 -0
  30. js7/api/joc/http/v_2_8_2/configuration/configuration.py +36 -0
  31. js7/api/joc/http/v_2_8_2/configuration/save.py +36 -0
  32. js7/api/joc/http/v_2_8_2/controller/abort.py +36 -0
  33. js7/api/joc/http/v_2_8_2/controller/abort_and_restart.py +36 -0
  34. js7/api/joc/http/v_2_8_2/controller/cluster/appoint_nodes.py +36 -0
  35. js7/api/joc/http/v_2_8_2/controller/cluster/confirm_node_loss.py +36 -0
  36. js7/api/joc/http/v_2_8_2/controller/cluster/switchover.py +36 -0
  37. js7/api/joc/http/v_2_8_2/controller/components.py +36 -0
  38. js7/api/joc/http/v_2_8_2/controller/controller.py +36 -0
  39. js7/api/joc/http/v_2_8_2/controller/register.py +42 -0
  40. js7/api/joc/http/v_2_8_2/controller/restart.py +36 -0
  41. js7/api/joc/http/v_2_8_2/controller/terminate.py +36 -0
  42. js7/api/joc/http/v_2_8_2/controller/test.py +36 -0
  43. js7/api/joc/http/v_2_8_2/controller/unregister.py +36 -0
  44. js7/api/joc/http/v_2_8_2/daily_plan/orders/cancel.py +36 -0
  45. js7/api/joc/http/v_2_8_2/daily_plan/orders/copy.py +36 -0
  46. js7/api/joc/http/v_2_8_2/daily_plan/orders/delete.py +36 -0
  47. js7/api/joc/http/v_2_8_2/daily_plan/orders/generate.py +36 -0
  48. js7/api/joc/http/v_2_8_2/daily_plan/orders/modify.py +36 -0
  49. js7/api/joc/http/v_2_8_2/daily_plan/orders/orders.py +36 -0
  50. js7/api/joc/http/v_2_8_2/daily_plan/orders/submit.py +36 -0
  51. js7/api/joc/http/v_2_8_2/daily_plan/projections/calendar.py +36 -0
  52. js7/api/joc/http/v_2_8_2/daily_plan/projections/dates.py +36 -0
  53. js7/api/joc/http/v_2_8_2/daily_plan/projections/recreate.py +28 -0
  54. js7/api/joc/http/v_2_8_2/daily_plan/submissions/delete.py +36 -0
  55. js7/api/joc/http/v_2_8_2/iam/account/change_password.py +36 -0
  56. js7/api/joc/http/v_2_8_2/iam/account/permissions.py +36 -0
  57. js7/api/joc/http/v_2_8_2/iam/account/rename.py +36 -0
  58. js7/api/joc/http/v_2_8_2/iam/account/store.py +36 -0
  59. js7/api/joc/http/v_2_8_2/iam/accounts/accounts.py +36 -0
  60. js7/api/joc/http/v_2_8_2/iam/accounts/delete.py +36 -0
  61. js7/api/joc/http/v_2_8_2/iam/accounts/disable.py +36 -0
  62. js7/api/joc/http/v_2_8_2/iam/accounts/enable.py +36 -0
  63. js7/api/joc/http/v_2_8_2/iam/accounts/reset_password.py +36 -0
  64. js7/api/joc/http/v_2_8_2/iam/blocked_account/store.py +36 -0
  65. js7/api/joc/http/v_2_8_2/iam/blocked_accounts/blocked_accounts.py +36 -0
  66. js7/api/joc/http/v_2_8_2/iam/blocked_accounts/delete.py +36 -0
  67. js7/api/joc/http/v_2_8_2/iam/folder/folder.py +36 -0
  68. js7/api/joc/http/v_2_8_2/iam/folder/rename.py +36 -0
  69. js7/api/joc/http/v_2_8_2/iam/folders/delete.py +36 -0
  70. js7/api/joc/http/v_2_8_2/iam/folders/folders.py +36 -0
  71. js7/api/joc/http/v_2_8_2/iam/folders/store.py +36 -0
  72. js7/api/joc/http/v_2_8_2/iam/identity_service/delete.py +36 -0
  73. js7/api/joc/http/v_2_8_2/iam/identity_service/identity_service.py +36 -0
  74. js7/api/joc/http/v_2_8_2/iam/identity_service/rename.py +36 -0
  75. js7/api/joc/http/v_2_8_2/iam/identity_service/store.py +42 -0
  76. js7/api/joc/http/v_2_8_2/iam/identity_services/identity_services.py +36 -0
  77. js7/api/joc/http/v_2_8_2/iam/permission/permission.py +36 -0
  78. js7/api/joc/http/v_2_8_2/iam/permission/rename.py +36 -0
  79. js7/api/joc/http/v_2_8_2/iam/permissions/delete.py +36 -0
  80. js7/api/joc/http/v_2_8_2/iam/permissions/permissions.py +36 -0
  81. js7/api/joc/http/v_2_8_2/iam/permissions/store.py +36 -0
  82. js7/api/joc/http/v_2_8_2/iam/role/rename.py +36 -0
  83. js7/api/joc/http/v_2_8_2/iam/role/role.py +36 -0
  84. js7/api/joc/http/v_2_8_2/iam/role/store.py +36 -0
  85. js7/api/joc/http/v_2_8_2/iam/roles/delete.py +36 -0
  86. js7/api/joc/http/v_2_8_2/iam/roles/roles.py +36 -0
  87. js7/api/joc/http/v_2_8_2/inventory/changes/changes.py +36 -0
  88. js7/api/joc/http/v_2_8_2/inventory/dependencies.py +33 -0
  89. js7/api/joc/http/v_2_8_2/inventory/deployment/deploy.py +36 -0
  90. js7/api/joc/http/v_2_8_2/inventory/deployment/import_deploy.py +66 -0
  91. js7/api/joc/http/v_2_8_2/inventory/deployment/revoke.py +36 -0
  92. js7/api/joc/http/v_2_8_2/inventory/export/export.py +36 -0
  93. js7/api/joc/http/v_2_8_2/inventory/export/folder.py +36 -0
  94. js7/api/joc/http/v_2_8_2/inventory/import_objects.py +88 -0
  95. js7/api/joc/http/v_2_8_2/inventory/releasables/recall/folder.py +36 -0
  96. js7/api/joc/http/v_2_8_2/inventory/releasables/recall/recall.py +36 -0
  97. js7/api/joc/http/v_2_8_2/inventory/release.py +36 -0
  98. js7/api/joc/http/v_2_8_2/inventory/remove/folder.py +36 -0
  99. js7/api/joc/http/v_2_8_2/inventory/remove/remove.py +36 -0
  100. js7/api/joc/http/v_2_8_2/inventory/repository/delete.py +36 -0
  101. js7/api/joc/http/v_2_8_2/inventory/repository/git/add.py +36 -0
  102. js7/api/joc/http/v_2_8_2/inventory/repository/git/checkout.py +36 -0
  103. js7/api/joc/http/v_2_8_2/inventory/repository/git/clone.py +36 -0
  104. js7/api/joc/http/v_2_8_2/inventory/repository/git/commit.py +36 -0
  105. js7/api/joc/http/v_2_8_2/inventory/repository/git/credentials/add.py +36 -0
  106. js7/api/joc/http/v_2_8_2/inventory/repository/git/credentials/credentials.py +28 -0
  107. js7/api/joc/http/v_2_8_2/inventory/repository/git/credentials/remove.py +36 -0
  108. js7/api/joc/http/v_2_8_2/inventory/repository/git/pull.py +36 -0
  109. js7/api/joc/http/v_2_8_2/inventory/repository/git/push.py +36 -0
  110. js7/api/joc/http/v_2_8_2/inventory/repository/read.py +36 -0
  111. js7/api/joc/http/v_2_8_2/inventory/repository/store.py +36 -0
  112. js7/api/joc/http/v_2_8_2/inventory/repository/update.py +36 -0
  113. js7/api/joc/http/v_2_8_2/inventory/revalidate/folder.py +36 -0
  114. js7/api/joc/http/v_2_8_2/inventory/store.py +36 -0
  115. js7/api/joc/http/v_2_8_2/inventory/trash/delete/delete.py +36 -0
  116. js7/api/joc/http/v_2_8_2/inventory/trash/delete/folder.py +36 -0
  117. js7/api/joc/http/v_2_8_2/inventory/trash/restore.py +36 -0
  118. js7/api/joc/http/v_2_8_2/inventory/validate.py +42 -0
  119. js7/api/joc/http/v_2_8_2/joc/cluster/restart.py +36 -0
  120. js7/api/joc/http/v_2_8_2/joc/cluster/run.py +36 -0
  121. js7/api/joc/http/v_2_8_2/joc/cluster/switch_member.py +36 -0
  122. js7/api/joc/http/v_2_8_2/joc/license.py +28 -0
  123. js7/api/joc/http/v_2_8_2/joc/proxies/restart.py +36 -0
  124. js7/api/joc/http/v_2_8_2/joc/version.py +28 -0
  125. js7/api/joc/http/v_2_8_2/joc/versions.py +36 -0
  126. js7/api/joc/http/v_2_8_2/orders/add.py +33 -0
  127. js7/api/joc/http/v_2_8_2/orders/cancel.py +33 -0
  128. js7/api/joc/http/v_2_8_2/orders/confirm.py +36 -0
  129. js7/api/joc/http/v_2_8_2/orders/continue.py +36 -0
  130. js7/api/joc/http/v_2_8_2/orders/history.py +36 -0
  131. js7/api/joc/http/v_2_8_2/orders/orders.py +36 -0
  132. js7/api/joc/http/v_2_8_2/orders/remove_when_terminated.py +33 -0
  133. js7/api/joc/http/v_2_8_2/orders/resume.py +36 -0
  134. js7/api/joc/http/v_2_8_2/orders/suspend.py +36 -0
  135. js7/api/joc/http/v_2_8_2/settings/settings.py +28 -0
  136. js7/api/joc/http/v_2_8_2/settings/store.py +36 -0
  137. js7/api/joc/http/v_2_8_2/tasks/history.py +36 -0
  138. js7/api/joc/http/v_2_8_2/workflow/transition.py +36 -0
  139. js7/api/joc/http/v_2_8_2/workflow/workflow.py +36 -0
  140. js7/api/joc/http/v_2_8_2/workflows/resume.py +36 -0
  141. js7/api/joc/http/v_2_8_2/workflows/skip.py +36 -0
  142. js7/api/joc/http/v_2_8_2/workflows/stop.py +36 -0
  143. js7/api/joc/http/v_2_8_2/workflows/suspend.py +36 -0
  144. js7/api/joc/http/v_2_8_2/workflows/unskip.py +36 -0
  145. js7/api/joc/http/v_2_8_2/workflows/unstop.py +36 -0
  146. js7/api/joc/http/v_2_8_2/workflows/workflows.py +36 -0
  147. js7/api/joc/interface/dispatcher.py +76 -0
  148. js7/api/joc/interface/interface.py +8 -0
  149. js7/api/joc/interface/resolver.py +75 -0
  150. js7/client/action/agent/confirm_node_loss_agent_action.py +75 -0
  151. js7/client/action/agent/delete_subagent_action.py +77 -0
  152. js7/client/action/agent/delete_subagent_clusters_action.py +75 -0
  153. js7/client/action/agent/deploy_cluster_agents_action.py +75 -0
  154. js7/client/action/agent/deploy_standalone_agents_action.py +75 -0
  155. js7/client/action/agent/deploy_subagent_clusters_action.py +75 -0
  156. js7/client/action/agent/disable_standalone_agents_action.py +75 -0
  157. js7/client/action/agent/disable_subagents_action.py +75 -0
  158. js7/client/action/agent/enable_standalone_agents_action.py +75 -0
  159. js7/client/action/agent/enable_subagents_action.py +75 -0
  160. js7/client/action/agent/export_agents_action.py +101 -0
  161. js7/client/action/agent/get_agents_status_action.py +55 -0
  162. js7/client/action/agent/import_agents_action.py +139 -0
  163. js7/client/action/agent/remove_agent_action.py +79 -0
  164. js7/client/action/agent/reset_agents_action.py +79 -0
  165. js7/client/action/agent/reset_subagent_action.py +79 -0
  166. js7/client/action/agent/revoke_cluster_agents_action.py +75 -0
  167. js7/client/action/agent/revoke_standalone_agents_action.py +75 -0
  168. js7/client/action/agent/revoke_subagent_clusters_action.py +75 -0
  169. js7/client/action/agent/store_cluster_agents_action.py +99 -0
  170. js7/client/action/agent/store_standalone_agents_action.py +87 -0
  171. js7/client/action/agent/store_subagent_clusters_action.py +83 -0
  172. js7/client/action/agent/store_subagents_action.py +97 -0
  173. js7/client/action/agent/switchover_agent_action.py +75 -0
  174. js7/client/action/controller/appoint_nodes_controller_action.py +67 -0
  175. js7/client/action/controller/cancel_and_restart_controller_action.py +72 -0
  176. js7/client/action/controller/cancel_controller_action.py +71 -0
  177. js7/client/action/controller/confirm_cluster_node_loss_action.py +68 -0
  178. js7/client/action/controller/get_controller_components_action.py +41 -0
  179. js7/client/action/controller/get_controller_status_action.py +72 -0
  180. js7/client/action/controller/register_controller_action.py +93 -0
  181. js7/client/action/controller/restart_controller_action.py +72 -0
  182. js7/client/action/controller/switchover_controller_cluster_action.py +67 -0
  183. js7/client/action/controller/terminate_controller_action.py +72 -0
  184. js7/client/action/controller/test_controller_instance_action.py +65 -0
  185. js7/client/action/controller/unregister_controller_action.py +68 -0
  186. js7/client/action/daily_plan/cancel_orders_action.py +59 -0
  187. js7/client/action/daily_plan/copy_orders_action.py +108 -0
  188. js7/client/action/daily_plan/create_projections_action.py +24 -0
  189. js7/client/action/daily_plan/delete_orders_action.py +80 -0
  190. js7/client/action/daily_plan/delete_submissions_action.py +83 -0
  191. js7/client/action/daily_plan/generate_orders_action.py +121 -0
  192. js7/client/action/daily_plan/get_calendar_projections_action.py +59 -0
  193. js7/client/action/daily_plan/get_orders_action.py +70 -0
  194. js7/client/action/daily_plan/get_projection_dates_action.py +59 -0
  195. js7/client/action/daily_plan/modify_orders_action.py +130 -0
  196. js7/client/action/daily_plan/submit_orders_action.py +79 -0
  197. js7/client/action/helper/decrypt_action.py +82 -0
  198. js7/client/action/helper/encrypt_action.py +87 -0
  199. js7/client/action/iam/block_account_action.py +71 -0
  200. js7/client/action/iam/change_account_password_action.py +96 -0
  201. js7/client/action/iam/disable_accounts_action.py +75 -0
  202. js7/client/action/iam/enable_accounts_action.py +75 -0
  203. js7/client/action/iam/get_account_permissions_action.py +75 -0
  204. js7/client/action/iam/get_accounts_action.py +76 -0
  205. js7/client/action/iam/get_blocked_accounts_action.py +76 -0
  206. js7/client/action/iam/get_folder_permissions_action.py +112 -0
  207. js7/client/action/iam/get_identity_service_settings_action.py +70 -0
  208. js7/client/action/iam/get_identity_services_action.py +102 -0
  209. js7/client/action/iam/get_permissions_action.py +113 -0
  210. js7/client/action/iam/get_roles_action.py +57 -0
  211. js7/client/action/iam/remove_accounts_action.py +75 -0
  212. js7/client/action/iam/remove_folder_permissions_action.py +91 -0
  213. js7/client/action/iam/remove_identity_service_action.py +67 -0
  214. js7/client/action/iam/remove_permissions_action.py +88 -0
  215. js7/client/action/iam/remove_roles_action.py +75 -0
  216. js7/client/action/iam/rename_account_action.py +83 -0
  217. js7/client/action/iam/rename_folder_permissions_action.py +100 -0
  218. js7/client/action/iam/rename_identity_service_action.py +75 -0
  219. js7/client/action/iam/rename_permission_action.py +103 -0
  220. js7/client/action/iam/rename_role_action.py +83 -0
  221. js7/client/action/iam/reset_account_passwords_action.py +75 -0
  222. js7/client/action/iam/set_folder_permissions_action.py +96 -0
  223. js7/client/action/iam/set_permissions_action.py +91 -0
  224. js7/client/action/iam/store_account_action.py +69 -0
  225. js7/client/action/iam/store_identity_service_action.py +75 -0
  226. js7/client/action/iam/store_identity_service_settings_action.py +74 -0
  227. js7/client/action/iam/store_role_action.py +79 -0
  228. js7/client/action/iam/unblock_accounts_action.py +67 -0
  229. js7/client/action/inventory/deploy_configurations_action.py +138 -0
  230. js7/client/action/inventory/export_configurations_action.py +203 -0
  231. js7/client/action/inventory/export_folders_action.py +160 -0
  232. js7/client/action/inventory/get_change_dependencies_action.py +161 -0
  233. js7/client/action/inventory/get_changes_action.py +59 -0
  234. js7/client/action/inventory/get_git_credentials_action.py +29 -0
  235. js7/client/action/inventory/git_add_action.py +72 -0
  236. js7/client/action/inventory/git_checkout_action.py +88 -0
  237. js7/client/action/inventory/git_clone_action.py +84 -0
  238. js7/client/action/inventory/git_commit_action.py +80 -0
  239. js7/client/action/inventory/git_pull_action.py +72 -0
  240. js7/client/action/inventory/git_push_action.py +76 -0
  241. js7/client/action/inventory/import_configurations_action.py +153 -0
  242. js7/client/action/inventory/import_deploy_configurations_action.py +188 -0
  243. js7/client/action/inventory/read_from_local_repository_action.py +67 -0
  244. js7/client/action/inventory/recall_folder_action.py +89 -0
  245. js7/client/action/inventory/recall_released_configuration_action.py +75 -0
  246. js7/client/action/inventory/release_configuartions_action.py +89 -0
  247. js7/client/action/inventory/remove_configurations_action.py +77 -0
  248. js7/client/action/inventory/remove_configurations_from_trash_action.py +80 -0
  249. js7/client/action/inventory/remove_folder_action.py +67 -0
  250. js7/client/action/inventory/remove_folder_from_trash_action.py +69 -0
  251. js7/client/action/inventory/remove_git_credentials_action.py +53 -0
  252. js7/client/action/inventory/remove_repository_configuration_action.py +84 -0
  253. js7/client/action/inventory/restore_configuration_from_trash_action.py +84 -0
  254. js7/client/action/inventory/revalidate_folder_action.py +46 -0
  255. js7/client/action/inventory/revoke_configurations_action.py +86 -0
  256. js7/client/action/inventory/store_configuration_action.py +79 -0
  257. js7/client/action/inventory/store_git_credentials_action.py +99 -0
  258. js7/client/action/inventory/store_repository_configuration_action.py +124 -0
  259. js7/client/action/inventory/update_repository_configuration_action.py +85 -0
  260. js7/client/action/inventory/validate_configuration_action.py +58 -0
  261. js7/client/action/joc/get_components_versions_action.py +57 -0
  262. js7/client/action/joc/get_license_info_action.py +22 -0
  263. js7/client/action/joc/get_settings_action.py +19 -0
  264. js7/client/action/joc/get_version_action.py +17 -0
  265. js7/client/action/joc/restart_proxies_action.py +50 -0
  266. js7/client/action/joc/restart_service_action.py +74 -0
  267. js7/client/action/joc/run_service_action.py +74 -0
  268. js7/client/action/joc/store_settings_action.py +62 -0
  269. js7/client/action/joc/switch_over_action.py +89 -0
  270. js7/client/action/order/add_orders_action.py +115 -0
  271. js7/client/action/order/cancel_orders_action.py +93 -0
  272. js7/client/action/order/confirm_orders_action.py +86 -0
  273. js7/client/action/order/continue_orders_action.py +86 -0
  274. js7/client/action/order/get_order_history_action.py +84 -0
  275. js7/client/action/order/get_orders_action.py +83 -0
  276. js7/client/action/order/remove_terminated_orders_action.py +86 -0
  277. js7/client/action/order/resume_orders_action.py +102 -0
  278. js7/client/action/order/suspend_orders_action.py +97 -0
  279. js7/client/action/task/get_task_history_info_action.py +88 -0
  280. js7/client/action/workflow/get_workflow_versions_action.py +131 -0
  281. js7/client/action/workflow/resume_workflows_action.py +76 -0
  282. js7/client/action/workflow/set_workflow_version_as_current_action.py +86 -0
  283. js7/client/action/workflow/skip_job_instructions_action.py +83 -0
  284. js7/client/action/workflow/stop_job_instructions_action.py +83 -0
  285. js7/client/action/workflow/suspend_workflows_action.py +76 -0
  286. js7/client/action/workflow/unskip_job_instructions_action.py +83 -0
  287. js7/client/action/workflow/unstop_job_instructions_action.py +79 -0
  288. js7/client/auth/auth_provider.py +109 -0
  289. js7/client/auth/login.py +34 -0
  290. js7/client/auth/logout.py +22 -0
  291. js7/client/client.py +250 -0
  292. js7/client/context.py +40 -0
  293. js7/client/feature/agent/agent.py +26 -0
  294. js7/client/feature/agent/deploy.py +134 -0
  295. js7/client/feature/agent/manage.py +363 -0
  296. js7/client/feature/agent/operate.py +577 -0
  297. js7/client/feature/controller/controller.py +19 -0
  298. js7/client/feature/controller/manage.py +214 -0
  299. js7/client/feature/controller/operate.py +274 -0
  300. js7/client/feature/daily_plan/daily_plan.py +14 -0
  301. js7/client/feature/daily_plan/manage.py +179 -0
  302. js7/client/feature/daily_plan/operate.py +354 -0
  303. js7/client/feature/iam/iam.py +14 -0
  304. js7/client/feature/iam/manage.py +1311 -0
  305. js7/client/feature/inventory/inventory.py +13 -0
  306. js7/client/feature/inventory/manage.py +943 -0
  307. js7/client/feature/inventory/manage_repository.py +533 -0
  308. js7/client/feature/joc/joc.py +18 -0
  309. js7/client/feature/joc/manage.py +102 -0
  310. js7/client/feature/joc/operate.py +185 -0
  311. js7/client/feature/order/manage.py +79 -0
  312. js7/client/feature/order/operate.py +346 -0
  313. js7/client/feature/order/order.py +18 -0
  314. js7/client/feature/task/task.py +54 -0
  315. js7/client/feature/workflow/manage.py +54 -0
  316. js7/client/feature/workflow/operate.py +336 -0
  317. js7/client/feature/workflow/workflow.py +19 -0
  318. js7/java/lib/3rd-party/bcpg-jdk15to18-1.78.1.jar +0 -0
  319. js7/java/lib/3rd-party/bcpkix-jdk15to18-1.78.1.jar +0 -0
  320. js7/java/lib/3rd-party/bcprov-jdk15to18-1.78.1.jar +0 -0
  321. js7/java/lib/3rd-party/bcutil-jdk15to18-1.78.1.jar +0 -0
  322. js7/java/lib/3rd-party/commons-io-2.15.1.jar +0 -0
  323. js7/java/lib/3rd-party/commons-lang3-3.14.0.jar +0 -0
  324. js7/java/lib/3rd-party/jackson-core-2.14.2.jar +0 -0
  325. js7/java/lib/3rd-party/jackson-databind-2.14.2.jar +0 -0
  326. js7/java/lib/3rd-party/jackson-dataformat-xml-2.14.2.jar +0 -0
  327. js7/java/lib/3rd-party/jakarta.annotation-api-2.1.1.jar +0 -0
  328. js7/java/lib/3rd-party/javax.activation-api-1.2.0.jar +0 -0
  329. js7/java/lib/3rd-party/jaxb-api-2.4.0-b180830.0359.jar +0 -0
  330. js7/java/lib/3rd-party/org.apache.logging.log4j.log4j-api-2.23.1.jar +0 -0
  331. js7/java/lib/3rd-party/org.apache.logging.log4j.log4j-core-2.23.1.jar +0 -0
  332. js7/java/lib/3rd-party/org.apache.logging.log4j.log4j-slf4j2-impl-2.23.1.jar +0 -0
  333. js7/java/lib/3rd-party/org.slf4j.slf4j-api-2.0.13.jar +0 -0
  334. js7/java/lib/3rd-party/stax2-api-4.2.1.jar +0 -0
  335. js7/java/lib/3rd-party/woodstox-core-6.5.0.jar +0 -0
  336. js7/java/lib/sos/sos-commons-encryption-2.7.3.jar +0 -0
  337. js7/java/lib/sos/sos-commons-exception-2.7.3.jar +0 -0
  338. js7/java/lib/sos/sos-commons-sign-2.7.3.jar +0 -0
  339. js7/java/lib/sos/sos-webservices-json-2.7.3.jar +0 -0
  340. js7/model/__init__.py +132 -0
  341. js7/model/configuration/auth_configuration.py +24 -0
  342. js7/model/configuration/client_configuration.py +6 -0
  343. js7/model/configuration/http_configuration.py +10 -0
  344. js7/model/error/http/joc_exceptions.py +151 -0
  345. js7/model/private/api/endpoint.py +30 -0
  346. js7/model/private/http/joc/joc_v_2_8_2.py +3666 -0
  347. js7/model/public/client/common/__init__.py +27 -0
  348. js7/model/public/client/common/accounts.py +21 -0
  349. js7/model/public/client/common/audit_log.py +8 -0
  350. js7/model/public/client/common/changes.py +18 -0
  351. js7/model/public/client/common/configurations.py +53 -0
  352. js7/model/public/client/common/cycle.py +12 -0
  353. js7/model/public/client/common/git_credentials.py +12 -0
  354. js7/model/public/client/common/identity_service.py +14 -0
  355. js7/model/public/client/common/schedule_time.py +50 -0
  356. js7/model/public/client/common/store_agents.py +96 -0
  357. js7/model/public/client/enum/__init__.py +19 -0
  358. js7/model/public/client/enum/object_types.py +48 -0
  359. js7/model/public/client/enum/operation_type.py +11 -0
  360. js7/model/public/client/enum/order_priority.py +9 -0
  361. js7/model/public/client/filter/__init__.py +35 -0
  362. js7/model/public/client/filter/daily_plan_order_filters.py +255 -0
  363. js7/model/public/client/filter/element/__init__.py +3 -0
  364. js7/model/public/client/filter/element/folder.py +6 -0
  365. js7/model/public/client/filter/element/workflow_id.py +10 -0
  366. js7/model/public/client/filter/export_filter.py +52 -0
  367. js7/model/public/client/filter/export_folders_filter.py +34 -0
  368. js7/model/public/client/filter/get_order_filter.py +59 -0
  369. js7/model/public/client/filter/order_history_filter.py +113 -0
  370. js7/model/public/client/filter/resume_order_filter.py +45 -0
  371. js7/model/public/client/filter/suspend_order_filter.py +44 -0
  372. js7/model/public/client/filter/tasks_filter.py +50 -0
  373. js7/model/public/client/input/__init__.py +2 -0
  374. js7/model/public/client/input/add_order.py +50 -0
  375. js7/service/http_service.py +206 -0
  376. js7/util/bytes_converter/bytes_to_archive_bytes.py +52 -0
  377. js7/util/bytes_converter/bytes_to_file.py +12 -0
  378. js7/util/bytes_converter/files_to_bytes.py +52 -0
  379. js7/util/bytes_converter/read_bytes_archive_files_to_bytes.py +69 -0
  380. js7/util/bytes_converter/sign_to_bytes.py +106 -0
  381. js7/util/check_matching_version.py +20 -0
  382. js7/util/detect_archive_type.py +37 -0
  383. js7/util/str_converter/order_id_to_order_name.py +5 -0
  384. js7/validator/http/joc_http_status_validator.py +155 -0
  385. js7_client_python-2.0.1.0.dist-info/LICENSE +674 -0
  386. js7_client_python-2.0.1.0.dist-info/METADATA +763 -0
  387. js7_client_python-2.0.1.0.dist-info/RECORD +389 -0
  388. js7_client_python-2.0.1.0.dist-info/WHEEL +5 -0
  389. js7_client_python-2.0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,138 @@
1
+ from typing import List, Optional
2
+
3
+ from ...context import Context
4
+ from ....model.public.client.common.audit_log import AuditLog
5
+ from ....model.public.client.common.configurations import DeployConfiguration, DraftConfiguration
6
+ from ....model.private.api.endpoint import EndpointCall
7
+ from ....model.private.http.joc.joc_v_2_8_2 import (
8
+ DeployFilter as DeployFilter_V_2_8_2,
9
+ OK as OK_V_2_8_2,
10
+ AuditParams as AuditParams_V_2_8_2,
11
+ DeployablesValidFilter as DeployablesValidFilter_V_2_8_2,
12
+ Config as Config_V_2_8_2,
13
+ PublishConfiguration as Configuration_V_2_8_2,
14
+ CommonConfigurationType as ConfigurationType_V_2_8_2
15
+ )
16
+
17
+ from ....util.check_matching_version import check_matching_version
18
+
19
+
20
+ # (i) Daily Plan operations such as add_orders_date_from should be executed in a separate function.
21
+ def deploy_configurations_action(
22
+ *,
23
+ context: Context,
24
+ controller_id: str,
25
+ delete_deployed_configs: Optional[List[DeployConfiguration]],
26
+ deploy_draft_configs: Optional[List[DraftConfiguration]],
27
+ redeploy_deployed_configs: Optional[List[DeployConfiguration]],
28
+ audit_log: Optional[AuditLog]
29
+ ) -> bool:
30
+ if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
31
+ request_data = _build_v_2_8_2_request(
32
+ controller_id=controller_id,
33
+ delete_deployed_configs=delete_deployed_configs,
34
+ deploy_draft_configs=deploy_draft_configs,
35
+ redeploy_deployed_configs=redeploy_deployed_configs,
36
+ audit_log=audit_log
37
+ )
38
+ else:
39
+ raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
40
+
41
+ # Calls the dispatcher for the matching JOC version
42
+ result = context.joc_api.dispatch(endpoint_id="inventory/deployment/deploy", call=EndpointCall(
43
+ http_service=context.http_service,
44
+ access_token=context.auth_provider.login(),
45
+ payload=request_data,
46
+ options=None,
47
+ ))
48
+
49
+ if isinstance(result, OK_V_2_8_2):
50
+ return bool(result.ok)
51
+
52
+ raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
53
+
54
+ #---------------------#
55
+ # Build 2.8.2 request #
56
+ #---------------------#
57
+ def _build_v_2_8_2_request(
58
+ *,
59
+ controller_id: str,
60
+ delete_deployed_configs: Optional[List[DeployConfiguration]],
61
+ deploy_draft_configs: Optional[List[DraftConfiguration]],
62
+ redeploy_deployed_configs: Optional[List[DeployConfiguration]],
63
+ audit_log: Optional[AuditLog]
64
+ ) -> DeployFilter_V_2_8_2:
65
+
66
+ # Validate: controller_id
67
+ if not controller_id:
68
+ raise ValueError("'controller_id' is required.")
69
+
70
+ # Validate: any_of(delete_deployed_object, deploy_draft_object, redeploy_deployed_object)
71
+ if not (delete_deployed_configs or deploy_draft_configs or redeploy_deployed_configs):
72
+ raise ValueError("Any of 'delete_deployed_configs, deploy_draft_configs, redeploy_deployed_configs' must be set.")
73
+
74
+ # Build: audit_log
75
+ res_audit_log = AuditParams_V_2_8_2(
76
+ ticket_link=audit_log.ticket_link,
77
+ comment=audit_log.comment,
78
+ time_spent=audit_log.time_spent
79
+ ) if audit_log else None
80
+
81
+ # Build: delete_deployed_object
82
+ res_delete: Optional[DeployablesValidFilter_V_2_8_2] = None
83
+ if delete_deployed_configs:
84
+ res_delete = DeployablesValidFilter_V_2_8_2(
85
+ deploy_configurations=[
86
+ Config_V_2_8_2(
87
+ configuration=Configuration_V_2_8_2(
88
+ commit_id=c.commit_id,
89
+ object_type=ConfigurationType_V_2_8_2(c.object_type), # Raises ValueErro() if invalid.
90
+ path=c.path,
91
+ recursive=c.recursive,
92
+ )
93
+ )
94
+ for c in delete_deployed_configs
95
+ ]
96
+ )
97
+
98
+ # Build: Store
99
+ store_draft_configs: Optional[List[Config_V_2_8_2]] = None
100
+ store_deploy_configs: Optional[List[Config_V_2_8_2]] = None
101
+ if deploy_draft_configs:
102
+ store_draft_configs = [
103
+ Config_V_2_8_2(configuration=Configuration_V_2_8_2(
104
+ commit_id=None,
105
+ object_type=ConfigurationType_V_2_8_2(c.object_type), # Raises ValueErro() if invalid.
106
+ path=c.path,
107
+ recursive=c.recursive,
108
+ ))
109
+ for c in deploy_draft_configs
110
+ ]
111
+
112
+ if redeploy_deployed_configs:
113
+ store_deploy_configs = [
114
+ Config_V_2_8_2(configuration=Configuration_V_2_8_2(
115
+ commit_id=c.commit_id,
116
+ object_type=ConfigurationType_V_2_8_2(c.object_type), # Raises ValueError() if invalid.
117
+ path=c.path,
118
+ recursive=c.recursive,
119
+ ))
120
+ for c in redeploy_deployed_configs
121
+ ]
122
+
123
+ res_store: Optional[DeployablesValidFilter_V_2_8_2] = None
124
+ if (store_draft_configs or store_deploy_configs):
125
+ res_store = DeployablesValidFilter_V_2_8_2(
126
+ draft_configurations=store_draft_configs,
127
+ deploy_configurations=store_deploy_configs
128
+ )
129
+
130
+ # Result
131
+ return DeployFilter_V_2_8_2(
132
+ controller_ids=[controller_id],
133
+ delete=res_delete,
134
+ store=res_store,
135
+ add_orders_date_from=None, # now()
136
+ include_late=None,
137
+ audit_log=res_audit_log,
138
+ )
@@ -0,0 +1,203 @@
1
+ from pathlib import Path
2
+ from typing import List, Literal, Optional, Union
3
+
4
+ from ...context import Context
5
+ from ....model.public.client.common.audit_log import AuditLog
6
+ from ....model.public.client.common.configurations import DraftConfiguration, DeployConfiguration
7
+ from ....model.public.client.filter.export_filter import ExportFilter
8
+ from ....model.private.api.endpoint import EndpointCall
9
+ from ....model.private.http.joc.joc_v_2_8_2 import (
10
+ PublishConfiguration as Configuration_V_2_8_2,
11
+ ExportFilter as ExportFilter_V_2_8_2,
12
+ ExportForSigning as ExportForSigning_V_2_8_2,
13
+ DeployablesValidFilter as DeployablesValidFilter_V_2_8_2,
14
+ CommonConfigurationType as ConfigurationType_V_2_8_2,
15
+ Config as Config_V_2_8_2,
16
+ ExportFile as ExportFile_V_2_8_2,
17
+ ArchiveFormat as ArchiveFormat_V_2_8_2,
18
+ ExportShallowCopy as ExportShallowCopy_V_2_8_2,
19
+ DeployablesFilter as DeployablesFilter_V_2_8_2,
20
+ ReleasablesFilter as ReleasablesFilter_V_2_8_2,
21
+ AuditParams as AuditParams_V_2_8_2
22
+ )
23
+
24
+ from ....util.check_matching_version import check_matching_version
25
+ from ....util.bytes_converter.bytes_to_file import bytes_to_file
26
+
27
+
28
+ def export_configurations_action(
29
+ *,
30
+ context: Context,
31
+ controller_id: str,
32
+ out_dir: Union[Path, str],
33
+ filename: str,
34
+ archive_format: Literal["ZIP", "TAR_GZ"],
35
+ filter: ExportFilter,
36
+ audit_log: Optional[AuditLog]
37
+ ) -> bool:
38
+
39
+ # Normalize out_path
40
+ out_dir = Path(out_dir)
41
+
42
+ # Determine expected suffix from archive_format
43
+ expected_suffix = ".tar.gz" if archive_format == "TAR_GZ" else ".zip"
44
+
45
+ # Append suffix if missing or wrong
46
+ if not filename.endswith((".zip", ".tar.gz")):
47
+ filename = filename + expected_suffix
48
+
49
+ if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
50
+ request_data = _build_v_2_8_2_request(
51
+ controller_id=controller_id,
52
+ out_dir=out_dir,
53
+ filename=filename,
54
+ archive_format=archive_format,
55
+ filter=filter,
56
+ audit_log=audit_log
57
+ )
58
+ else:
59
+ raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
60
+
61
+ result = context.joc_api.dispatch(endpoint_id="inventory/export", call=EndpointCall(
62
+ http_service=context.http_service,
63
+ access_token=context.auth_provider.login(),
64
+ payload=request_data,
65
+ options=None,
66
+ ))
67
+
68
+ if isinstance(result, bytes):
69
+ return bytes_to_file(data=result, out_path=Path(out_dir / filename))
70
+
71
+ raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
72
+
73
+ #---------------------#
74
+ # Build 2.8.2 request #
75
+ #---------------------#
76
+ def _build_v_2_8_2_request(
77
+ *,
78
+ controller_id: str,
79
+ out_dir: Path,
80
+ filename: str,
81
+ archive_format: Literal["ZIP", "TAR_GZ"],
82
+ filter: ExportFilter,
83
+ audit_log: Optional[AuditLog]
84
+ ) -> ExportFilter_V_2_8_2:
85
+
86
+ # Validate: controller_id
87
+ if not controller_id:
88
+ raise ValueError("'controller_id' is required.")
89
+
90
+ # Validate: out_dir
91
+ if not out_dir.is_dir():
92
+ raise ValueError("'out_dir' must be a directory.")
93
+
94
+ # Validate: filename
95
+ if not filename:
96
+ raise ValueError("'filename' is required.")
97
+
98
+ # Validate: archive_format
99
+ if archive_format not in ("ZIP", "TAR_GZ"):
100
+ raise ValueError("'archive_format' must be 'ZIP' or 'TAR_GZ'.")
101
+
102
+ # Validate: filter.configurations
103
+ if not filter.configurations:
104
+ raise ValueError("At least one configuration must be provided.")
105
+
106
+ # Build: export_file
107
+ res_export_file = ExportFile_V_2_8_2(
108
+ filename=Path(out_dir / filename).name,
109
+ format=(ArchiveFormat_V_2_8_2(archive_format)) # Raises ValueError() if invalid.
110
+ )
111
+
112
+ # Build: configurations
113
+ res_draft_configurations: Optional[List[Config_V_2_8_2]] = None
114
+ res_deploy_configurations: Optional[List[Config_V_2_8_2]] = None
115
+ res_release_configurations: Optional[List[Config_V_2_8_2]] = None
116
+ for config in filter.configurations:
117
+ if isinstance(config, DraftConfiguration):
118
+ if not res_draft_configurations:
119
+ res_draft_configurations = []
120
+
121
+ res_draft_configurations.append(
122
+ Config_V_2_8_2(
123
+ configuration=Configuration_V_2_8_2(
124
+ object_type=ConfigurationType_V_2_8_2(config.object_type), # Raises ValueError() if invalid.
125
+ path=config.path,
126
+ recursive=config.recursive
127
+ )
128
+ )
129
+ )
130
+
131
+ continue
132
+
133
+ if isinstance(config, DeployConfiguration):
134
+ if not res_deploy_configurations:
135
+ res_deploy_configurations = []
136
+
137
+ res_deploy_configurations.append(
138
+ Config_V_2_8_2(
139
+ configuration=Configuration_V_2_8_2(
140
+ commit_id=config.commit_id,
141
+ object_type=ConfigurationType_V_2_8_2(config.object_type), # Raises ValueError() if invalid.
142
+ path=config.path,
143
+ recursive=config.recursive
144
+ )
145
+ )
146
+ )
147
+
148
+ continue
149
+
150
+ else:
151
+ if not res_release_configurations:
152
+ res_release_configurations = []
153
+
154
+ res_release_configurations.append(
155
+ Config_V_2_8_2(
156
+ configuration=Configuration_V_2_8_2(
157
+ object_type=ConfigurationType_V_2_8_2(config.object_type), # Raises ValueError() if invalid.
158
+ path=config.path,
159
+ recursive=config.recursive
160
+ )
161
+ )
162
+ )
163
+
164
+ # Build: for_signing
165
+ res_for_signing = ExportForSigning_V_2_8_2(
166
+ controller_id=controller_id,
167
+ deployables=DeployablesValidFilter_V_2_8_2(
168
+ deploy_configurations=res_deploy_configurations,
169
+ draft_configurations=res_draft_configurations
170
+ )
171
+ ) if filter.for_signing is True else None
172
+
173
+ # Build: shallow_copy
174
+ res_shallow_copy = ExportShallowCopy_V_2_8_2(
175
+ incl_all_tags=filter.include_all_tags,
176
+ deployables=DeployablesFilter_V_2_8_2(
177
+ without_invalid=filter.without_invalid_drafts,
178
+ draft_configurations=res_draft_configurations,
179
+ deploy_configurations=res_deploy_configurations
180
+ ),
181
+ releasables=ReleasablesFilter_V_2_8_2(
182
+ without_invalid=filter.without_invalid_drafts,
183
+ draft_configurations=res_draft_configurations,
184
+ released_configurations=res_release_configurations
185
+ ) if (res_draft_configurations or res_release_configurations) else None
186
+ ) if filter.for_signing is False else None
187
+
188
+ # Build: audit_log
189
+ res_audit_log = AuditParams_V_2_8_2(
190
+ ticket_link=audit_log.ticket_link,
191
+ comment=audit_log.comment,
192
+ time_spent=audit_log.time_spent
193
+ ) if audit_log else None
194
+
195
+ # Result
196
+ return ExportFilter_V_2_8_2(
197
+ export_file=res_export_file,
198
+ for_signing=res_for_signing,
199
+ shallow_copy=res_shallow_copy,
200
+ start_folder=filter.start_folder,
201
+ use_short_path=filter.use_short_path,
202
+ audit_log=res_audit_log
203
+ )
@@ -0,0 +1,160 @@
1
+ from pathlib import Path
2
+ from typing import List, Literal, Optional, Union
3
+
4
+ from ...context import Context
5
+ from ....model.public.client.common.audit_log import AuditLog
6
+ from ....model.public.client.enum.object_types import DeployObjectType, ReleaseObjectType
7
+ from ....model.public.client.filter.export_folders_filter import ExportFoldersFilter
8
+ from ....model.private.api.endpoint import EndpointCall
9
+ from ....model.private.http.joc.joc_v_2_8_2 import (
10
+ ArchiveFormat as ArchiveFormat_V_2_8_2,
11
+ CommonConfigurationType as ConfigurationType_V_2_8_2,
12
+ ExportFile as ExportFile_V_2_8_2,
13
+ ExportFolderFilter as ExportFolderFilter_V_2_8_2,
14
+ ExportFolderForSigning as ExportFolderForSigning_V_2_8_2,
15
+ ShallowCopy as ShallowCopy_V_2_8_2,
16
+ AuditParams as AuditParams_V_2_8_2
17
+ )
18
+
19
+ from ....util.check_matching_version import check_matching_version
20
+
21
+
22
+ def export_folders_action(
23
+ *,
24
+ context: Context,
25
+ controller_id: str,
26
+ out_dir: Union[Path, str],
27
+ filename: str,
28
+ archive_format: Literal["ZIP", "TAR_GZ"],
29
+ filter: ExportFoldersFilter,
30
+ audit_log: Optional[AuditLog]
31
+ ) -> bool:
32
+
33
+ # Normalize out_path
34
+ out_dir = Path(out_dir)
35
+
36
+ # Determine expected suffix from archive_format
37
+ expected_suffix = ".tar.gz" if archive_format == "TAR_GZ" else ".zip"
38
+
39
+ # Append suffix if missing or wrong
40
+ if not filename.endswith((".zip", ".tar.gz")):
41
+ filename = filename + expected_suffix
42
+
43
+ if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
44
+ request_data = _build_v_2_8_2_request(
45
+ controller_id=controller_id,
46
+ out_dir=out_dir,
47
+ filename=filename,
48
+ archive_format=archive_format,
49
+ filter=filter,
50
+ audit_log=audit_log
51
+ )
52
+ else:
53
+ raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
54
+
55
+ result = context.joc_api.dispatch(endpoint_id="inventory/export/folder", call=EndpointCall(
56
+ http_service=context.http_service,
57
+ access_token=context.auth_provider.login(),
58
+ payload=request_data,
59
+ options=None,
60
+ ))
61
+
62
+ if isinstance(result, bytes):
63
+ out_dir.mkdir(parents=True, exist_ok=True)
64
+ out_file = out_dir / filename
65
+ out_file.write_bytes(result)
66
+ return out_file.exists()
67
+
68
+ raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
69
+
70
+ #---------------------#
71
+ # Build 2.8.2 request #
72
+ #---------------------#
73
+ def _build_v_2_8_2_request(
74
+ controller_id: str,
75
+ out_dir: Path,
76
+ filename: str,
77
+ archive_format: Literal["ZIP", "TAR_GZ"],
78
+ filter: ExportFoldersFilter,
79
+ audit_log: Optional[AuditLog]
80
+ ) -> ExportFolderFilter_V_2_8_2:
81
+
82
+ # Validate: controller_id
83
+ if not controller_id:
84
+ raise ValueError("'controller_id' is required.")
85
+
86
+ # Validate: out_dir
87
+ if not out_dir.is_dir():
88
+ raise ValueError("'out_dir' must be a directory.")
89
+
90
+ # Validate: filename
91
+ if not filename:
92
+ raise ValueError("'filename' is required.")
93
+
94
+ # Validate: archive_format
95
+ if archive_format not in ("ZIP", "TAR_GZ"):
96
+ raise ValueError("'archive_format' must be 'ZIP' or 'TAR_GZ'.")
97
+
98
+ # Validate: folder_paths
99
+ if not filter.folder_paths:
100
+ raise ValueError("At least one folder path in 'folder_paths' is required")
101
+
102
+ # Build: object_types - Default: All object types.
103
+ res_object_types: List[ConfigurationType_V_2_8_2] = []
104
+ if filter.object_types:
105
+ for obj_type in filter.object_types:
106
+ res_object_types.append(ConfigurationType_V_2_8_2(obj_type.value)) # Raises ValueError() if invalid
107
+ elif filter.for_signing:
108
+ for obj_type in DeployObjectType:
109
+ res_object_types.append(ConfigurationType_V_2_8_2(obj_type.value)) # Raises ValueError() if invalid
110
+ else:
111
+ for obj_type in ReleaseObjectType:
112
+ res_object_types.append(ConfigurationType_V_2_8_2(obj_type.value)) # Raises ValueError() if invalid
113
+
114
+ for obj_type in DeployObjectType:
115
+ try:
116
+ ReleaseObjectType(obj_type.value) # exists -> skip
117
+ except ValueError:
118
+ res_object_types.append(ConfigurationType_V_2_8_2(obj_type.value)) # Raises ValueError() if invalid
119
+
120
+ # Build: for_signing_result and shallow_copy_result
121
+ for_signing_result: Optional[ExportFolderForSigning_V_2_8_2] = None
122
+ shallow_copy_result: Optional[ShallowCopy_V_2_8_2] = None
123
+ if filter.for_signing is True:
124
+ for_signing_result = ExportFolderForSigning_V_2_8_2(
125
+ controller_id=controller_id,
126
+ folders=filter.folder_paths,
127
+ object_types=res_object_types,
128
+ recursive=True,
129
+ without_deployed=filter.no_deployed,
130
+ without_drafts=filter.no_draft,
131
+ )
132
+ else:
133
+ shallow_copy_result = ShallowCopy_V_2_8_2(
134
+ folders=filter.folder_paths,
135
+ object_types=res_object_types,
136
+ incl_all_tags=True,
137
+ only_valid_objects=filter.no_invalid,
138
+ recursive=filter.recursive,
139
+ without_deployed=filter.no_deployed,
140
+ without_drafts=filter.no_draft,
141
+ without_released=filter.no_released,
142
+ )
143
+
144
+ # Build: audit_log
145
+ res_audit_log = AuditParams_V_2_8_2(
146
+ ticket_link=audit_log.ticket_link,
147
+ comment=audit_log.comment,
148
+ time_spent=audit_log.time_spent
149
+ ) if audit_log else None
150
+
151
+ return ExportFolderFilter_V_2_8_2(
152
+ export_file=ExportFile_V_2_8_2(
153
+ filename=filename,
154
+ format=ArchiveFormat_V_2_8_2(archive_format)
155
+ ),
156
+ for_signing=for_signing_result,
157
+ shallow_copy=shallow_copy_result,
158
+ use_short_path=filter.use_short_path,
159
+ audit_log=res_audit_log
160
+ )
@@ -0,0 +1,161 @@
1
+ from typing import List, Optional, Set
2
+
3
+ from ...context import Context
4
+ from ....model.public.client.common.changes import Change, ChangeDependencies, ChangeStatus
5
+ from ....model.public.client.enum.object_types import ObjectType
6
+ from ....model.public.client.enum.operation_type import OperationType
7
+ from ....model.private.api.endpoint import EndpointCall
8
+ from ....model.private.http.joc.joc_v_2_8_2 import (
9
+ GetDependenciesRequest as GetDependenciesRequest_V_2_8_2,
10
+ GetDependenciesResponse as GetDependenciesResponse_V_2_8_2,
11
+ OperationType as OperationType_V_2_8_2,
12
+ RequestItem as RequestItem_V_2_8_2,
13
+ ResponseObject as ResponseObject_V_2_8_2,
14
+ )
15
+
16
+ from ....util.check_matching_version import check_matching_version
17
+
18
+
19
+ def get_change_dependencies_action(
20
+ *,
21
+ context: Context,
22
+ operation_type: OperationType,
23
+ changes: List[Change],
24
+ filter_paths: Optional[List[str]],
25
+ filter_no_references: bool,
26
+ filter_no_referencing: bool
27
+ ) -> List[ChangeDependencies]:
28
+
29
+ if check_matching_version(min="2.6.5", max="2.8.3", check=context.version):
30
+ request_data = _build_v_2_8_2_request(operation_type=operation_type, changes=changes)
31
+ else:
32
+ raise RuntimeError(f"Version {context.version} is not compatible with building the request.")
33
+
34
+ result = context.joc_api.dispatch(endpoint_id="inventory/dependencies", call=EndpointCall(
35
+ http_service=context.http_service,
36
+ access_token=context.auth_provider.login(),
37
+ payload=request_data,
38
+ options=None,
39
+ ))
40
+
41
+ if isinstance(result, GetDependenciesResponse_V_2_8_2):
42
+ return _build_v_2_8_2_response(
43
+ response=result,
44
+ filter_paths=filter_paths,
45
+ filter_no_references=filter_no_references,
46
+ filter_no_referencing=filter_no_referencing
47
+ )
48
+
49
+ raise RuntimeError(f"Unexpected response type: {type(result).__name__}")
50
+
51
+ #---------------------#
52
+ # Build 2.8.2 request #
53
+ #---------------------#
54
+ def _build_v_2_8_2_request(*, operation_type: OperationType, changes: List[Change]) -> GetDependenciesRequest_V_2_8_2:
55
+ # Validate: changes
56
+ if not changes:
57
+ raise ValueError("At least one change in 'changes' is required.")
58
+
59
+ # Validate: changes
60
+ for c in changes:
61
+ if not (c.name and c.object_type):
62
+ raise ValueError("'name' and 'object_type' are required in every change.")
63
+
64
+ return GetDependenciesRequest_V_2_8_2(
65
+ operation_type=OperationType_V_2_8_2(operation_type.value), # Raises ValueError() if invalid.
66
+ configurations=[
67
+ RequestItem_V_2_8_2(name=c.name, type=c.object_type)
68
+ for c in changes
69
+ if c.name and c.object_type # Process only valid changes
70
+ ]
71
+ )
72
+
73
+ #----------------------#
74
+ # Build 2.8.2 response #
75
+ #----------------------#
76
+ def _build_v_2_8_2_response(
77
+ *,
78
+ response: GetDependenciesResponse_V_2_8_2,
79
+ filter_paths: Optional[List[str]],
80
+ filter_no_references: bool,
81
+ filter_no_referencing: bool,
82
+ ) -> List[ChangeDependencies]:
83
+
84
+ # No processable result: Return []
85
+ if not response.objects or not response.requested_items:
86
+ return []
87
+
88
+ def _build_status(config: ResponseObject_V_2_8_2) -> Set[ChangeStatus]:
89
+ status: Set[ChangeStatus] = set()
90
+ if config.valid is True:
91
+ status.add("VALID")
92
+ if config.deployed is True:
93
+ status.add("DEPLOYED")
94
+ if config.released is True:
95
+ status.add("RELEASED")
96
+ return status
97
+
98
+ result: List[ChangeDependencies] = [] # root_id: value
99
+
100
+ for req_id in response.requested_items:
101
+ found_parent: Optional[Change] = None
102
+ found_dependencies: List[Change] = []
103
+
104
+ for id, config in response.objects.items():
105
+ # Found: Parent configuration
106
+ if float(id) == req_id:
107
+ if not config.object_type:
108
+ raise RuntimeError("'object_type' is required in response.")
109
+
110
+ found_parent = Change(
111
+ path=config.path,
112
+ name=config.name,
113
+ object_type=ObjectType(config.object_type.value),
114
+ status=_build_status(config)
115
+ )
116
+
117
+ continue
118
+
119
+ in_references = bool(config.references and req_id in config.references)
120
+ in_referenced_by = bool(config.referenced_by and req_id in config.referenced_by)
121
+ in_enforced_references = bool(config.enforced_references and req_id in config.enforced_references)
122
+ in_enforced_referenced_by = bool(config.enforced_referenced_by and req_id in config.enforced_referenced_by)
123
+
124
+ # Append filter logic
125
+ if filter_no_references:
126
+ in_references = False
127
+ if filter_no_referencing:
128
+ in_referenced_by = False
129
+
130
+ # Skips configurations starting with 'filter_paths'
131
+ if config.path and filter_paths:
132
+ skip = False
133
+ for p in filter_paths:
134
+ if config.path.startswith(p):
135
+ skip = True
136
+ break
137
+
138
+ if skip:
139
+ continue
140
+
141
+ if in_references or in_referenced_by or in_enforced_references or in_enforced_referenced_by:
142
+ if not config.object_type:
143
+ raise RuntimeError("'object_type' is required in response.")
144
+
145
+ found_dependencies.append(Change(
146
+ path=config.path,
147
+ name=config.name,
148
+ object_type=ObjectType(config.object_type.value),
149
+ status=_build_status(config)
150
+ ))
151
+
152
+ if found_parent:
153
+ result.append(ChangeDependencies(
154
+ path=found_parent.path,
155
+ name=found_parent.name,
156
+ object_type=found_parent.object_type,
157
+ status=found_parent.status,
158
+ dependencies=found_dependencies
159
+ ))
160
+
161
+ return result