cognite-toolkit 0.7.30__py3-none-any.whl → 0.7.51__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 (281) hide show
  1. cognite_toolkit/_cdf.py +5 -6
  2. cognite_toolkit/_cdf_tk/apps/__init__.py +2 -0
  3. cognite_toolkit/_cdf_tk/apps/_core_app.py +7 -1
  4. cognite_toolkit/_cdf_tk/apps/_download_app.py +2 -2
  5. cognite_toolkit/_cdf_tk/apps/_dump_app.py +1 -1
  6. cognite_toolkit/_cdf_tk/apps/_import_app.py +41 -0
  7. cognite_toolkit/_cdf_tk/apps/_migrate_app.py +183 -8
  8. cognite_toolkit/_cdf_tk/builders/_function.py +81 -9
  9. cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
  10. cognite_toolkit/_cdf_tk/client/_resource_base.py +187 -0
  11. cognite_toolkit/_cdf_tk/client/_toolkit_client.py +44 -12
  12. cognite_toolkit/_cdf_tk/client/api/agents.py +107 -0
  13. cognite_toolkit/_cdf_tk/client/api/annotations.py +129 -0
  14. cognite_toolkit/_cdf_tk/client/api/assets.py +130 -0
  15. cognite_toolkit/_cdf_tk/client/api/containers.py +132 -0
  16. cognite_toolkit/_cdf_tk/client/api/data_models.py +137 -0
  17. cognite_toolkit/_cdf_tk/client/api/datasets.py +141 -0
  18. cognite_toolkit/_cdf_tk/client/api/events.py +129 -0
  19. cognite_toolkit/_cdf_tk/client/api/extraction_pipelines.py +148 -0
  20. cognite_toolkit/_cdf_tk/client/api/filemetadata.py +176 -0
  21. cognite_toolkit/_cdf_tk/client/api/function_schedules.py +115 -0
  22. cognite_toolkit/_cdf_tk/client/api/functions.py +113 -0
  23. cognite_toolkit/_cdf_tk/client/api/graphql_data_models.py +167 -0
  24. cognite_toolkit/_cdf_tk/client/api/groups.py +121 -0
  25. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_destinations.py +131 -0
  26. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_jobs.py +122 -0
  27. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_mappings.py +129 -0
  28. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_sources.py +136 -0
  29. cognite_toolkit/_cdf_tk/client/api/hosted_extractors.py +23 -0
  30. cognite_toolkit/_cdf_tk/client/api/infield.py +40 -35
  31. cognite_toolkit/_cdf_tk/client/api/instances.py +139 -0
  32. cognite_toolkit/_cdf_tk/client/api/labels.py +125 -0
  33. cognite_toolkit/_cdf_tk/client/api/{canvas.py → legacy/canvas.py} +16 -8
  34. cognite_toolkit/_cdf_tk/client/api/{charts.py → legacy/charts.py} +1 -1
  35. cognite_toolkit/_cdf_tk/client/api/{extended_data_modeling.py → legacy/extended_data_modeling.py} +1 -1
  36. cognite_toolkit/_cdf_tk/client/api/{extended_files.py → legacy/extended_files.py} +2 -2
  37. cognite_toolkit/_cdf_tk/client/api/{extended_functions.py → legacy/extended_functions.py} +9 -9
  38. cognite_toolkit/_cdf_tk/client/api/{extended_raw.py → legacy/extended_raw.py} +1 -1
  39. cognite_toolkit/_cdf_tk/client/api/{extended_timeseries.py → legacy/extended_timeseries.py} +5 -2
  40. cognite_toolkit/_cdf_tk/client/api/legacy/location_filters.py +112 -0
  41. cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +8 -0
  42. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/capabilities.py +1 -1
  43. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/data_postprocessing.py +1 -1
  44. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/frames.py +1 -1
  45. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/locations.py +1 -1
  46. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/maps.py +1 -1
  47. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/robots.py +2 -2
  48. cognite_toolkit/_cdf_tk/client/api/legacy/search_config.py +53 -0
  49. cognite_toolkit/_cdf_tk/client/api/location_filters.py +140 -75
  50. cognite_toolkit/_cdf_tk/client/api/migration.py +2 -3
  51. cognite_toolkit/_cdf_tk/client/api/project.py +9 -8
  52. cognite_toolkit/_cdf_tk/client/api/raw.py +204 -0
  53. cognite_toolkit/_cdf_tk/client/api/relationships.py +133 -0
  54. cognite_toolkit/_cdf_tk/client/api/robotics.py +19 -0
  55. cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +127 -0
  56. cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +138 -0
  57. cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +122 -0
  58. cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +127 -0
  59. cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +122 -0
  60. cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +122 -0
  61. cognite_toolkit/_cdf_tk/client/api/search.py +2 -2
  62. cognite_toolkit/_cdf_tk/client/api/search_config.py +83 -31
  63. cognite_toolkit/_cdf_tk/client/api/security_categories.py +94 -0
  64. cognite_toolkit/_cdf_tk/client/api/sequences.py +133 -0
  65. cognite_toolkit/_cdf_tk/client/api/simulator_models.py +154 -0
  66. cognite_toolkit/_cdf_tk/client/api/simulators.py +8 -0
  67. cognite_toolkit/_cdf_tk/client/api/spaces.py +117 -0
  68. cognite_toolkit/_cdf_tk/client/api/streams.py +68 -56
  69. cognite_toolkit/_cdf_tk/client/api/three_d.py +385 -34
  70. cognite_toolkit/_cdf_tk/client/api/timeseries.py +137 -0
  71. cognite_toolkit/_cdf_tk/client/api/token.py +1 -1
  72. cognite_toolkit/_cdf_tk/client/api/transformations.py +146 -0
  73. cognite_toolkit/_cdf_tk/client/api/views.py +139 -0
  74. cognite_toolkit/_cdf_tk/client/api/workflow_triggers.py +128 -0
  75. cognite_toolkit/_cdf_tk/client/api/workflow_versions.py +138 -0
  76. cognite_toolkit/_cdf_tk/client/api/workflows.py +119 -0
  77. cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py +10 -0
  78. cognite_toolkit/_cdf_tk/client/cdf_client/api.py +358 -0
  79. cognite_toolkit/_cdf_tk/client/cdf_client/responses.py +38 -0
  80. cognite_toolkit/_cdf_tk/{utils → client}/http_client/__init__.py +30 -0
  81. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_client.py +26 -16
  82. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_data_classes.py +18 -2
  83. cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py +151 -0
  84. cognite_toolkit/_cdf_tk/client/http_client/_exception.py +13 -0
  85. cognite_toolkit/_cdf_tk/client/http_client/_item_classes.py +118 -0
  86. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_tracker.py +5 -2
  87. cognite_toolkit/_cdf_tk/client/request_classes/base.py +19 -0
  88. cognite_toolkit/_cdf_tk/client/request_classes/filters.py +113 -0
  89. cognite_toolkit/_cdf_tk/client/request_classes/graphql.py +28 -0
  90. cognite_toolkit/_cdf_tk/client/resource_classes/__init__.py +0 -0
  91. cognite_toolkit/_cdf_tk/client/resource_classes/agent.py +130 -0
  92. cognite_toolkit/_cdf_tk/client/resource_classes/annotation.py +79 -0
  93. cognite_toolkit/_cdf_tk/client/resource_classes/apm_config.py +128 -0
  94. cognite_toolkit/_cdf_tk/client/resource_classes/asset.py +47 -0
  95. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/charts_data.py +1 -1
  96. cognite_toolkit/_cdf_tk/client/resource_classes/cognite_file.py +53 -0
  97. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/__init__.py +168 -0
  98. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_constraints.py +37 -0
  99. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_container.py +50 -0
  100. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_model.py +73 -0
  101. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_types.py +116 -0
  102. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_indexes.py +26 -0
  103. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_instance.py +154 -0
  104. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_references.py +86 -0
  105. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_space.py +26 -0
  106. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view.py +143 -0
  107. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view_property.py +152 -0
  108. cognite_toolkit/_cdf_tk/client/resource_classes/dataset.py +35 -0
  109. cognite_toolkit/_cdf_tk/client/resource_classes/event.py +40 -0
  110. cognite_toolkit/_cdf_tk/client/resource_classes/extraction_pipeline.py +59 -0
  111. cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py +52 -0
  112. cognite_toolkit/_cdf_tk/client/resource_classes/function.py +53 -0
  113. cognite_toolkit/_cdf_tk/client/resource_classes/function_schedule.py +65 -0
  114. cognite_toolkit/_cdf_tk/client/resource_classes/graphql_data_model.py +40 -0
  115. cognite_toolkit/_cdf_tk/client/resource_classes/group/__init__.py +187 -0
  116. cognite_toolkit/_cdf_tk/client/resource_classes/group/_constants.py +2 -0
  117. cognite_toolkit/_cdf_tk/client/resource_classes/group/acls.py +653 -0
  118. cognite_toolkit/_cdf_tk/client/resource_classes/group/capability.py +56 -0
  119. cognite_toolkit/_cdf_tk/client/resource_classes/group/group.py +63 -0
  120. cognite_toolkit/_cdf_tk/client/resource_classes/group/scopes.py +166 -0
  121. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_destination.py +34 -0
  122. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_job.py +134 -0
  123. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_mapping.py +72 -0
  124. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/__init__.py +63 -0
  125. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_auth.py +63 -0
  126. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_base.py +26 -0
  127. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_certificate.py +20 -0
  128. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_eventhub.py +31 -0
  129. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_kafka.py +53 -0
  130. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_mqtt.py +36 -0
  131. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_rest.py +49 -0
  132. cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +59 -0
  133. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/infield.py +1 -1
  134. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/instance_api.py +53 -14
  135. cognite_toolkit/_cdf_tk/client/resource_classes/label.py +27 -0
  136. cognite_toolkit/_cdf_tk/client/resource_classes/legacy/__init__.py +0 -0
  137. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/canvas.py +48 -15
  138. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/charts.py +1 -1
  139. cognite_toolkit/_cdf_tk/client/resource_classes/location_filter.py +84 -0
  140. cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +44 -0
  141. cognite_toolkit/_cdf_tk/client/resource_classes/relationship.py +49 -0
  142. cognite_toolkit/_cdf_tk/client/resource_classes/resource_view_mapping.py +38 -0
  143. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/__init__.py +37 -0
  144. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_capability.py +53 -0
  145. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_common.py +34 -0
  146. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_data_post_processing.py +49 -0
  147. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_frame.py +46 -0
  148. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_location.py +36 -0
  149. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_map.py +65 -0
  150. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_robot.py +58 -0
  151. cognite_toolkit/_cdf_tk/client/resource_classes/search_config.py +54 -0
  152. cognite_toolkit/_cdf_tk/client/resource_classes/securitycategory.py +24 -0
  153. cognite_toolkit/_cdf_tk/client/resource_classes/sequence.py +45 -0
  154. cognite_toolkit/_cdf_tk/client/resource_classes/sequence_rows.py +56 -0
  155. cognite_toolkit/_cdf_tk/client/resource_classes/simulator_model.py +50 -0
  156. cognite_toolkit/_cdf_tk/client/resource_classes/streamlit_.py +71 -0
  157. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/streams.py +9 -26
  158. cognite_toolkit/_cdf_tk/client/resource_classes/three_d.py +135 -0
  159. cognite_toolkit/_cdf_tk/client/resource_classes/timeseries.py +52 -0
  160. cognite_toolkit/_cdf_tk/client/resource_classes/transformation.py +140 -0
  161. cognite_toolkit/_cdf_tk/client/resource_classes/workflow.py +27 -0
  162. cognite_toolkit/_cdf_tk/client/resource_classes/workflow_trigger.py +63 -0
  163. cognite_toolkit/_cdf_tk/client/resource_classes/workflow_version.py +155 -0
  164. cognite_toolkit/_cdf_tk/client/testing.py +54 -17
  165. cognite_toolkit/_cdf_tk/commands/__init__.py +1 -0
  166. cognite_toolkit/_cdf_tk/commands/_migrate/command.py +103 -108
  167. cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +29 -16
  168. cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
  169. cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +38 -6
  170. cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +262 -36
  171. cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py +1 -0
  172. cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +1 -1
  173. cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +39 -38
  174. cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +227 -8
  175. cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
  176. cognite_toolkit/_cdf_tk/commands/_purge.py +14 -16
  177. cognite_toolkit/_cdf_tk/commands/_upload.py +1 -1
  178. cognite_toolkit/_cdf_tk/commands/build_cmd.py +12 -2
  179. cognite_toolkit/_cdf_tk/commands/build_v2/__init__.py +0 -0
  180. cognite_toolkit/_cdf_tk/commands/build_v2/_module_parser.py +138 -0
  181. cognite_toolkit/_cdf_tk/commands/build_v2/_modules_parser.py +163 -0
  182. cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +228 -0
  183. cognite_toolkit/_cdf_tk/commands/build_v2/build_parameters.py +71 -0
  184. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_modules.py +27 -0
  185. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py +22 -0
  186. cognite_toolkit/_cdf_tk/commands/dump_resource.py +4 -4
  187. cognite_toolkit/_cdf_tk/commands/pull.py +97 -2
  188. cognite_toolkit/_cdf_tk/commands/run.py +1 -1
  189. cognite_toolkit/_cdf_tk/cruds/__init__.py +16 -6
  190. cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +9 -5
  191. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +2 -0
  192. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +6 -2
  193. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +70 -89
  194. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +1 -1
  195. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +1 -1
  196. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +1 -1
  197. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +34 -25
  198. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +50 -59
  199. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +14 -2
  200. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +1 -1
  201. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -3
  202. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +1 -1
  203. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +6 -1
  204. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +5 -4
  205. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +1 -1
  206. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/simulators.py +122 -0
  207. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +15 -31
  208. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +42 -47
  209. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +49 -14
  210. cognite_toolkit/_cdf_tk/data_classes/__init__.py +3 -0
  211. cognite_toolkit/_cdf_tk/data_classes/_issues.py +36 -0
  212. cognite_toolkit/_cdf_tk/data_classes/_module_directories.py +2 -1
  213. cognite_toolkit/_cdf_tk/data_classes/_module_toml.py +1 -0
  214. cognite_toolkit/_cdf_tk/data_classes/_tracking_info.py +4 -0
  215. cognite_toolkit/_cdf_tk/feature_flags.py +8 -0
  216. cognite_toolkit/_cdf_tk/resource_classes/__init__.py +2 -0
  217. cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +6 -0
  218. cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
  219. cognite_toolkit/_cdf_tk/resource_classes/simulator_model.py +17 -0
  220. cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +173 -5
  221. cognite_toolkit/_cdf_tk/storageio/_applications.py +53 -15
  222. cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +117 -107
  223. cognite_toolkit/_cdf_tk/storageio/_base.py +3 -1
  224. cognite_toolkit/_cdf_tk/storageio/_datapoints.py +7 -7
  225. cognite_toolkit/_cdf_tk/storageio/_file_content.py +65 -56
  226. cognite_toolkit/_cdf_tk/storageio/_instances.py +1 -1
  227. cognite_toolkit/_cdf_tk/storageio/_raw.py +1 -1
  228. cognite_toolkit/_cdf_tk/storageio/logger.py +162 -0
  229. cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py +10 -1
  230. cognite_toolkit/_cdf_tk/storageio/selectors/_three_d.py +34 -0
  231. cognite_toolkit/_cdf_tk/tk_warnings/__init__.py +2 -0
  232. cognite_toolkit/_cdf_tk/tk_warnings/fileread.py +20 -0
  233. cognite_toolkit/_cdf_tk/utils/__init__.py +11 -1
  234. cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
  235. cognite_toolkit/_cdf_tk/utils/interactive_select.py +53 -4
  236. cognite_toolkit/_cdf_tk/utils/modules.py +7 -0
  237. cognite_toolkit/_cdf_tk/utils/pip_validator.py +96 -0
  238. cognite_toolkit/_cdf_tk/utils/useful_types.py +4 -7
  239. cognite_toolkit/_cdf_tk/utils/useful_types2.py +14 -0
  240. cognite_toolkit/_cdf_tk/validation.py +4 -0
  241. cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
  242. cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
  243. cognite_toolkit/_resources/cdf.toml +1 -1
  244. cognite_toolkit/_version.py +1 -1
  245. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/METADATA +13 -3
  246. cognite_toolkit-0.7.51.dist-info/RECORD +445 -0
  247. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/WHEEL +2 -2
  248. cognite_toolkit/_cdf_tk/client/api/robotics/__init__.py +0 -3
  249. cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +0 -17
  250. cognite_toolkit/_cdf_tk/client/data_classes/base.py +0 -87
  251. cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +0 -47
  252. cognite_toolkit/_cdf_tk/prototypes/import_app.py +0 -41
  253. cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +0 -187
  254. cognite_toolkit/_cdf_tk/utils/http_client/_exception.py +0 -4
  255. cognite_toolkit-0.7.30.dist-info/RECORD +0 -316
  256. /cognite_toolkit/_cdf_tk/client/{data_classes → api/legacy}/__init__.py +0 -0
  257. /cognite_toolkit/_cdf_tk/client/api/{dml.py → legacy/dml.py} +0 -0
  258. /cognite_toolkit/_cdf_tk/client/api/{fixed_transformations.py → legacy/fixed_transformations.py} +0 -0
  259. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/api.py +0 -0
  260. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/utlis.py +0 -0
  261. /cognite_toolkit/_cdf_tk/{prototypes/commands → client/request_classes}/__init__.py +0 -0
  262. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/capabilities.py +0 -0
  263. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/apm_config_v1.py +0 -0
  264. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extendable_cognite_file.py +0 -0
  265. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetadata.py +0 -0
  266. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetdata.py +0 -0
  267. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_timeseries.py +0 -0
  268. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/functions.py +0 -0
  269. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/graphql_data_models.py +0 -0
  270. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/instances.py +0 -0
  271. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/location_filters.py +0 -0
  272. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/migration.py +0 -0
  273. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/pending_instances_ids.py +0 -0
  274. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/project.py +0 -0
  275. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/raw.py +0 -0
  276. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/robotics.py +0 -0
  277. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/search_config.py +0 -0
  278. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/sequences.py +0 -0
  279. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/streamlit_.py +0 -0
  280. /cognite_toolkit/_cdf_tk/{prototypes/commands/import_.py → commands/_import_cmd.py} +0 -0
  281. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,653 @@
1
+ """ACL (Access Control Sequence) definitions for Group capabilities.
2
+
3
+ Based on the API specification at:
4
+ https://api-docs.cognite.com/20230101/tag/Groups/operation/createGroups
5
+ """
6
+
7
+ from collections.abc import Sequence
8
+ from typing import Annotated, Any, Literal, TypeAlias
9
+
10
+ from pydantic import BeforeValidator, Field, TypeAdapter, model_serializer, model_validator
11
+ from pydantic_core.core_schema import FieldSerializationInfo
12
+
13
+ from cognite_toolkit._cdf_tk.client._resource_base import BaseModelObject
14
+ from cognite_toolkit._cdf_tk.client.resource_classes.group._constants import ACL_NAME, SCOPE_NAME
15
+ from cognite_toolkit._cdf_tk.utils._auxiliary import get_concrete_subclasses
16
+
17
+ from .scopes import (
18
+ AllScope,
19
+ AppConfigScope,
20
+ AssetRootIDScope,
21
+ CurrentUserScope,
22
+ DataSetScope,
23
+ ExperimentScope,
24
+ ExtractionPipelineScope,
25
+ IDScope,
26
+ IDScopeLowerCase,
27
+ InstancesScope,
28
+ PartitionScope,
29
+ PostgresGatewayUsersScope,
30
+ Scope,
31
+ SpaceIDScope,
32
+ TableScope,
33
+ )
34
+
35
+
36
+ class Acl(BaseModelObject):
37
+ """Base class for all ACL (Access Control Sequence) definitions."""
38
+
39
+ acl_name: str
40
+ actions: Sequence[str]
41
+ scope: Scope
42
+
43
+ @model_validator(mode="before")
44
+ @classmethod
45
+ def convert_scope_format(cls, value: Any) -> Any:
46
+ """Convert scope from API format {'all': {}} to model format {'scope_name': 'all'}."""
47
+ if not isinstance(value, dict):
48
+ return value
49
+ scope = value.get("scope")
50
+ if not isinstance(scope, dict):
51
+ return value
52
+ # If scope already has scope_name, it's in the correct format
53
+ if SCOPE_NAME in scope:
54
+ return value
55
+ # Convert from API format: find the scope key and extract its data
56
+ scope_name = next(iter(scope.keys()), None)
57
+ if scope_name is not None:
58
+ scope_data = scope.get(scope_name, {})
59
+ if isinstance(scope_data, dict):
60
+ new_scope = {SCOPE_NAME: scope_name, **scope_data}
61
+ value = dict(value)
62
+ value["scope"] = new_scope
63
+ return value
64
+
65
+ # MyPy complains that info; FieldSerializationInfo is not compatible with info: Any
66
+ # It is.
67
+ @model_serializer # type: ignore[type-var]
68
+ def convert_scope_to_api_format(self, info: FieldSerializationInfo) -> dict[str, Any]:
69
+ """Convert scope from model format {'scope_name': 'all'} to API format {'all': {}}."""
70
+ output: dict[str, Any] = {"actions": self.actions}
71
+ scope = self.scope.model_dump(**vars(info))
72
+ if isinstance(scope, dict):
73
+ output["scope"] = {self.scope.scope_name: scope}
74
+ return output
75
+
76
+
77
+ class AgentsAcl(Acl):
78
+ """ACL for Agents resources."""
79
+
80
+ acl_name: Literal["agentsAcl"] = Field("agentsAcl", exclude=True)
81
+ actions: Sequence[Literal["READ", "WRITE", "RUN"]]
82
+ scope: AllScope
83
+
84
+
85
+ class AnalyticsAcl(Acl):
86
+ """ACL for Analytics resources."""
87
+
88
+ acl_name: Literal["analyticsAcl"] = Field("analyticsAcl", exclude=True)
89
+ actions: Sequence[Literal["READ", "EXECUTE", "LIST"]]
90
+ scope: AllScope
91
+
92
+
93
+ class AnnotationsAcl(Acl):
94
+ """ACL for Annotations resources."""
95
+
96
+ acl_name: Literal["annotationsAcl"] = Field("annotationsAcl", exclude=True)
97
+ actions: Sequence[Literal["READ", "WRITE", "SUGGEST", "REVIEW"]]
98
+ scope: AllScope
99
+
100
+
101
+ class AppConfigAcl(Acl):
102
+ """ACL for App Config resources."""
103
+
104
+ acl_name: Literal["appConfigAcl"] = Field("appConfigAcl", exclude=True)
105
+ actions: Sequence[Literal["READ", "WRITE"]]
106
+ scope: AllScope | AppConfigScope
107
+
108
+
109
+ class AssetsAcl(Acl):
110
+ """ACL for Assets resources."""
111
+
112
+ acl_name: Literal["assetsAcl"] = Field("assetsAcl", exclude=True)
113
+ actions: Sequence[Literal["READ", "WRITE"]]
114
+ scope: AllScope | DataSetScope
115
+
116
+
117
+ class AuditlogAcl(Acl):
118
+ """ACL for Audit Log resources."""
119
+
120
+ acl_name: Literal["auditlogAcl"] = Field("auditlogAcl", exclude=True)
121
+ actions: Sequence[Literal["READ"]]
122
+ scope: AllScope
123
+
124
+
125
+ class DataModelInstancesAcl(Acl):
126
+ """ACL for Data Model Instances resources."""
127
+
128
+ acl_name: Literal["dataModelInstancesAcl"] = Field("dataModelInstancesAcl", exclude=True)
129
+ actions: Sequence[Literal["READ", "WRITE", "WRITE_PROPERTIES"]]
130
+ scope: AllScope | SpaceIDScope
131
+
132
+
133
+ class DataModelsAcl(Acl):
134
+ """ACL for Data Models resources."""
135
+
136
+ acl_name: Literal["dataModelsAcl"] = Field("dataModelsAcl", exclude=True)
137
+ actions: Sequence[Literal["READ", "WRITE"]]
138
+ scope: AllScope | SpaceIDScope
139
+
140
+
141
+ class DataSetsAcl(Acl):
142
+ """ACL for Data Sets resources."""
143
+
144
+ acl_name: Literal["datasetsAcl"] = Field("datasetsAcl", exclude=True)
145
+ actions: Sequence[Literal["READ", "WRITE", "OWNER"]]
146
+ scope: AllScope | IDScope
147
+
148
+
149
+ class DiagramParsingAcl(Acl):
150
+ """ACL for Diagram Parsing resources."""
151
+
152
+ acl_name: Literal["diagramParsingAcl"] = Field("diagramParsingAcl", exclude=True)
153
+ actions: Sequence[Literal["READ", "WRITE"]]
154
+ scope: AllScope
155
+
156
+
157
+ class DigitalTwinAcl(Acl):
158
+ """ACL for Digital Twin resources."""
159
+
160
+ acl_name: Literal["digitalTwinAcl"] = Field("digitalTwinAcl", exclude=True)
161
+ actions: Sequence[Literal["READ", "WRITE"]]
162
+ scope: AllScope
163
+
164
+
165
+ class DocumentFeedbackAcl(Acl):
166
+ """ACL for Document Feedback resources."""
167
+
168
+ acl_name: Literal["documentFeedbackAcl"] = Field("documentFeedbackAcl", exclude=True)
169
+ actions: Sequence[Literal["CREATE", "READ", "DELETE"]]
170
+ scope: AllScope
171
+
172
+
173
+ class DocumentPipelinesAcl(Acl):
174
+ """ACL for Document Pipelines resources."""
175
+
176
+ acl_name: Literal["documentPipelinesAcl"] = Field("documentPipelinesAcl", exclude=True)
177
+ actions: Sequence[Literal["READ", "WRITE"]]
178
+ scope: AllScope
179
+
180
+
181
+ class EntityMatchingAcl(Acl):
182
+ """ACL for Entity Matching resources."""
183
+
184
+ acl_name: Literal["entitymatchingAcl"] = Field("entitymatchingAcl", exclude=True)
185
+ actions: Sequence[Literal["READ", "WRITE"]]
186
+ scope: AllScope
187
+
188
+
189
+ class EventsAcl(Acl):
190
+ """ACL for Events resources."""
191
+
192
+ acl_name: Literal["eventsAcl"] = Field("eventsAcl", exclude=True)
193
+ actions: Sequence[Literal["READ", "WRITE"]]
194
+ scope: AllScope | DataSetScope
195
+
196
+
197
+ class ExperimentsAcl(Acl):
198
+ """ACL for Experiments resources."""
199
+
200
+ acl_name: Literal["experimentAcl"] = Field("experimentAcl", exclude=True)
201
+ actions: Sequence[Literal["USE"]]
202
+ scope: ExperimentScope
203
+
204
+
205
+ class ExtractionConfigsAcl(Acl):
206
+ """ACL for Extraction Configs resources."""
207
+
208
+ acl_name: Literal["extractionConfigsAcl"] = Field("extractionConfigsAcl", exclude=True)
209
+ actions: Sequence[Literal["READ", "WRITE"]]
210
+ scope: AllScope | DataSetScope | ExtractionPipelineScope
211
+
212
+
213
+ class ExtractionPipelinesAcl(Acl):
214
+ """ACL for Extraction Pipelines resources."""
215
+
216
+ acl_name: Literal["extractionPipelinesAcl"] = Field("extractionPipelinesAcl", exclude=True)
217
+ actions: Sequence[Literal["READ", "WRITE"]]
218
+ scope: AllScope | IDScope | DataSetScope
219
+
220
+
221
+ class ExtractionRunsAcl(Acl):
222
+ """ACL for Extraction Runs resources."""
223
+
224
+ acl_name: Literal["extractionRunsAcl"] = Field("extractionRunsAcl", exclude=True)
225
+ actions: Sequence[Literal["READ", "WRITE"]]
226
+ scope: AllScope | DataSetScope | ExtractionPipelineScope
227
+
228
+
229
+ class FilePipelinesAcl(Acl):
230
+ """ACL for File Pipelines resources."""
231
+
232
+ acl_name: Literal["filePipelinesAcl"] = Field("filePipelinesAcl", exclude=True)
233
+ actions: Sequence[Literal["READ", "WRITE"]]
234
+ scope: AllScope
235
+
236
+
237
+ class FilesAcl(Acl):
238
+ """ACL for Files resources."""
239
+
240
+ acl_name: Literal["filesAcl"] = Field("filesAcl", exclude=True)
241
+ actions: Sequence[Literal["READ", "WRITE"]]
242
+ scope: AllScope | DataSetScope
243
+
244
+
245
+ class FunctionsAcl(Acl):
246
+ """ACL for Functions resources."""
247
+
248
+ acl_name: Literal["functionsAcl"] = Field("functionsAcl", exclude=True)
249
+ actions: Sequence[Literal["READ", "WRITE"]]
250
+ scope: AllScope
251
+
252
+
253
+ class GeospatialAcl(Acl):
254
+ """ACL for Geospatial resources."""
255
+
256
+ acl_name: Literal["geospatialAcl"] = Field("geospatialAcl", exclude=True)
257
+ actions: Sequence[Literal["READ", "WRITE"]]
258
+ scope: AllScope
259
+
260
+
261
+ class GeospatialCrsAcl(Acl):
262
+ """ACL for Geospatial CRS resources."""
263
+
264
+ acl_name: Literal["geospatialCrsAcl"] = Field("geospatialCrsAcl", exclude=True)
265
+ actions: Sequence[Literal["READ", "WRITE"]]
266
+ scope: AllScope
267
+
268
+
269
+ class GroupsAcl(Acl):
270
+ """ACL for Groups resources."""
271
+
272
+ acl_name: Literal["groupsAcl"] = Field("groupsAcl", exclude=True)
273
+ actions: Sequence[Literal["CREATE", "DELETE", "READ", "LIST", "UPDATE"]]
274
+ scope: AllScope | CurrentUserScope
275
+
276
+
277
+ class HostedExtractorsAcl(Acl):
278
+ """ACL for Hosted Extractors resources."""
279
+
280
+ acl_name: Literal["hostedExtractorsAcl"] = Field("hostedExtractorsAcl", exclude=True)
281
+ actions: Sequence[Literal["READ", "WRITE"]]
282
+ scope: AllScope
283
+
284
+
285
+ class LabelsAcl(Acl):
286
+ """ACL for Labels resources."""
287
+
288
+ acl_name: Literal["labelsAcl"] = Field("labelsAcl", exclude=True)
289
+ actions: Sequence[Literal["READ", "WRITE"]]
290
+ scope: AllScope | DataSetScope
291
+
292
+
293
+ class LegacyGenericsAcl(Acl):
294
+ """ACL for Legacy Generics resources."""
295
+
296
+ acl_name: Literal["genericsAcl"] = Field("genericsAcl", exclude=True)
297
+ actions: Sequence[Literal["READ", "WRITE"]]
298
+ scope: AllScope
299
+
300
+
301
+ class LegacyModelHostingAcl(Acl):
302
+ """ACL for Legacy Model Hosting resources."""
303
+
304
+ acl_name: Literal["modelHostingAcl"] = Field("modelHostingAcl", exclude=True)
305
+ actions: Sequence[Literal["READ", "WRITE"]]
306
+ scope: AllScope
307
+
308
+
309
+ class LocationFiltersAcl(Acl):
310
+ """ACL for Location Filters resources."""
311
+
312
+ acl_name: Literal["locationFiltersAcl"] = Field("locationFiltersAcl", exclude=True)
313
+ actions: Sequence[Literal["READ", "WRITE"]]
314
+ scope: AllScope | IDScope
315
+
316
+
317
+ class MonitoringTasksAcl(Acl):
318
+ """ACL for Monitoring Tasks resources."""
319
+
320
+ acl_name: Literal["monitoringTasksAcl"] = Field("monitoringTasksAcl", exclude=True)
321
+ actions: Sequence[Literal["READ", "WRITE"]]
322
+ scope: AllScope
323
+
324
+
325
+ class NotificationsAcl(Acl):
326
+ """ACL for Notifications resources."""
327
+
328
+ acl_name: Literal["notificationsAcl"] = Field("notificationsAcl", exclude=True)
329
+ actions: Sequence[Literal["READ", "WRITE"]]
330
+ scope: AllScope
331
+
332
+
333
+ class PipelinesAcl(Acl):
334
+ """ACL for Pipelines resources."""
335
+
336
+ acl_name: Literal["pipelinesAcl"] = Field("pipelinesAcl", exclude=True)
337
+ actions: Sequence[Literal["READ", "WRITE"]]
338
+ scope: AllScope
339
+
340
+
341
+ class PostgresGatewayAcl(Acl):
342
+ """ACL for PostgreSQL Gateway resources."""
343
+
344
+ acl_name: Literal["postgresGatewayAcl"] = Field("postgresGatewayAcl", exclude=True)
345
+ actions: Sequence[Literal["READ", "WRITE"]]
346
+ scope: AllScope | PostgresGatewayUsersScope
347
+
348
+
349
+ class ProjectsAcl(Acl):
350
+ """ACL for Projects resources."""
351
+
352
+ acl_name: Literal["projectsAcl"] = Field("projectsAcl", exclude=True)
353
+ actions: Sequence[Literal["READ", "CREATE", "LIST", "UPDATE", "DELETE"]]
354
+ scope: AllScope
355
+
356
+
357
+ class RawAcl(Acl):
358
+ """ACL for RAW resources."""
359
+
360
+ acl_name: Literal["rawAcl"] = Field("rawAcl", exclude=True)
361
+ actions: Sequence[Literal["READ", "WRITE", "LIST"]]
362
+ scope: AllScope | TableScope
363
+
364
+
365
+ class RelationshipsAcl(Acl):
366
+ """ACL for Relationships resources."""
367
+
368
+ acl_name: Literal["relationshipsAcl"] = Field("relationshipsAcl", exclude=True)
369
+ actions: Sequence[Literal["READ", "WRITE"]]
370
+ scope: AllScope | DataSetScope
371
+
372
+
373
+ class RoboticsAcl(Acl):
374
+ """ACL for Robotics resources."""
375
+
376
+ acl_name: Literal["roboticsAcl"] = Field("roboticsAcl", exclude=True)
377
+ actions: Sequence[Literal["READ", "CREATE", "UPDATE", "DELETE"]]
378
+ scope: AllScope | DataSetScope
379
+
380
+
381
+ class SAPWritebackAcl(Acl):
382
+ """ACL for SAP Writeback resources."""
383
+
384
+ acl_name: Literal["sapWritebackAcl"] = Field("sapWritebackAcl", exclude=True)
385
+ actions: Sequence[Literal["READ", "WRITE"]]
386
+ scope: AllScope | InstancesScope
387
+
388
+
389
+ class SAPWritebackRequestsAcl(Acl):
390
+ """ACL for SAP Writeback Requests resources."""
391
+
392
+ acl_name: Literal["sapWritebackRequestsAcl"] = Field("sapWritebackRequestsAcl", exclude=True)
393
+ actions: Sequence[Literal["WRITE", "LIST"]]
394
+ scope: AllScope | InstancesScope
395
+
396
+
397
+ class ScheduledCalculationsAcl(Acl):
398
+ """ACL for Scheduled Calculations resources."""
399
+
400
+ acl_name: Literal["scheduledCalculationsAcl"] = Field("scheduledCalculationsAcl", exclude=True)
401
+ actions: Sequence[Literal["READ", "WRITE"]]
402
+ scope: AllScope
403
+
404
+
405
+ class SecurityCategoriesAcl(Acl):
406
+ """ACL for Security Categories resources."""
407
+
408
+ acl_name: Literal["securityCategoriesAcl"] = Field("securityCategoriesAcl", exclude=True)
409
+ actions: Sequence[Literal["MEMBEROF", "LIST", "CREATE", "UPDATE", "DELETE"]]
410
+ scope: AllScope | IDScopeLowerCase
411
+
412
+
413
+ class SeismicAcl(Acl):
414
+ """ACL for Seismic resources."""
415
+
416
+ acl_name: Literal["seismicAcl"] = Field("seismicAcl", exclude=True)
417
+ actions: Sequence[Literal["READ", "WRITE"]]
418
+ scope: AllScope | PartitionScope
419
+
420
+
421
+ class SequencesAcl(Acl):
422
+ """ACL for Sequences resources."""
423
+
424
+ acl_name: Literal["sequencesAcl"] = Field("sequencesAcl", exclude=True)
425
+ actions: Sequence[Literal["READ", "WRITE"]]
426
+ scope: AllScope | DataSetScope
427
+
428
+
429
+ class SessionsAcl(Acl):
430
+ """ACL for Sessions resources."""
431
+
432
+ acl_name: Literal["sessionsAcl"] = Field("sessionsAcl", exclude=True)
433
+ actions: Sequence[Literal["LIST", "CREATE", "DELETE"]]
434
+ scope: AllScope
435
+
436
+
437
+ class StreamRecordsAcl(Acl):
438
+ """ACL for Stream Records resources."""
439
+
440
+ acl_name: Literal["streamRecordsAcl"] = Field("streamRecordsAcl", exclude=True)
441
+ actions: Sequence[Literal["READ", "WRITE"]]
442
+ scope: AllScope | SpaceIDScope
443
+
444
+
445
+ class StreamsAcl(Acl):
446
+ """ACL for Streams resources."""
447
+
448
+ acl_name: Literal["streamsAcl"] = Field("streamsAcl", exclude=True)
449
+ actions: Sequence[Literal["READ", "CREATE", "DELETE"]]
450
+ scope: AllScope
451
+
452
+
453
+ class TemplateGroupsAcl(Acl):
454
+ """ACL for Template Groups resources."""
455
+
456
+ acl_name: Literal["templateGroupsAcl"] = Field("templateGroupsAcl", exclude=True)
457
+ actions: Sequence[Literal["READ", "WRITE"]]
458
+ scope: AllScope | DataSetScope
459
+
460
+
461
+ class TemplateInstancesAcl(Acl):
462
+ """ACL for Template Instances resources."""
463
+
464
+ acl_name: Literal["templateInstancesAcl"] = Field("templateInstancesAcl", exclude=True)
465
+ actions: Sequence[Literal["READ", "WRITE"]]
466
+ scope: AllScope | DataSetScope
467
+
468
+
469
+ class ThreeDAcl(Acl):
470
+ """ACL for 3D resources."""
471
+
472
+ acl_name: Literal["threedAcl"] = Field("threedAcl", exclude=True)
473
+ actions: Sequence[Literal["READ", "CREATE", "UPDATE", "DELETE"]]
474
+ scope: AllScope | DataSetScope
475
+
476
+
477
+ class TimeSeriesAcl(Acl):
478
+ """ACL for Time Series resources."""
479
+
480
+ acl_name: Literal["timeSeriesAcl"] = Field("timeSeriesAcl", exclude=True)
481
+ actions: Sequence[Literal["READ", "WRITE"]]
482
+ scope: AllScope | DataSetScope | IDScopeLowerCase | AssetRootIDScope
483
+
484
+
485
+ class TimeSeriesSubscriptionsAcl(Acl):
486
+ """ACL for Time Series Subscriptions resources."""
487
+
488
+ acl_name: Literal["timeSeriesSubscriptionsAcl"] = Field("timeSeriesSubscriptionsAcl", exclude=True)
489
+ actions: Sequence[Literal["READ", "WRITE"]]
490
+ scope: AllScope | DataSetScope
491
+
492
+
493
+ class TransformationsAcl(Acl):
494
+ """ACL for Transformations resources."""
495
+
496
+ acl_name: Literal["transformationsAcl"] = Field("transformationsAcl", exclude=True)
497
+ actions: Sequence[Literal["READ", "WRITE"]]
498
+ scope: AllScope | DataSetScope
499
+
500
+
501
+ class TypesAcl(Acl):
502
+ """ACL for Types resources."""
503
+
504
+ acl_name: Literal["typesAcl"] = Field("typesAcl", exclude=True)
505
+ actions: Sequence[Literal["READ", "WRITE"]]
506
+ scope: AllScope
507
+
508
+
509
+ class UserProfilesAcl(Acl):
510
+ """ACL for User Profiles resources."""
511
+
512
+ acl_name: Literal["userProfilesAcl"] = Field("userProfilesAcl", exclude=True)
513
+ actions: Sequence[Literal["READ"]]
514
+ scope: AllScope
515
+
516
+
517
+ class VideoStreamingAcl(Acl):
518
+ """ACL for Video Streaming resources."""
519
+
520
+ acl_name: Literal["videoStreamingAcl"] = Field("videoStreamingAcl", exclude=True)
521
+ actions: Sequence[Literal["READ", "WRITE", "SUBSCRIBE", "PUBLISH"]]
522
+ scope: AllScope | DataSetScope
523
+
524
+
525
+ class VisionModelAcl(Acl):
526
+ """ACL for Vision Model resources."""
527
+
528
+ acl_name: Literal["visionModelAcl"] = Field("visionModelAcl", exclude=True)
529
+ actions: Sequence[Literal["READ", "WRITE"]]
530
+ scope: AllScope
531
+
532
+
533
+ class WellsAcl(Acl):
534
+ """ACL for Wells resources."""
535
+
536
+ acl_name: Literal["wellsAcl"] = Field("wellsAcl", exclude=True)
537
+ actions: Sequence[Literal["READ", "WRITE"]]
538
+ scope: AllScope
539
+
540
+
541
+ class WorkflowOrchestrationAcl(Acl):
542
+ """ACL for Workflow Orchestration resources."""
543
+
544
+ acl_name: Literal["workflowOrchestrationAcl"] = Field("workflowOrchestrationAcl", exclude=True)
545
+ actions: Sequence[Literal["READ", "WRITE"]]
546
+ scope: AllScope | DataSetScope
547
+
548
+
549
+ class SimulatorsAcl(Acl):
550
+ """ACL for Simulators resources."""
551
+
552
+ acl_name: Literal["simulatorsAcl"] = Field("simulatorsAcl", exclude=True)
553
+ actions: Sequence[Literal["READ", "WRITE"]]
554
+ scope: AllScope | DataSetScope
555
+
556
+
557
+ class UnknownAcl(Acl):
558
+ """Fallback for unknown ACL types."""
559
+
560
+ acl_name: Literal["unknownAcl"] = Field("unknownAcl", exclude=True)
561
+ actions: Sequence[str]
562
+ scope: AllScope
563
+
564
+
565
+ def _get_acl_name(cls: type[Acl]) -> str | None:
566
+ """Get the acl_name default value from a Pydantic model class."""
567
+ field = cls.model_fields.get("acl_name")
568
+ if field is not None and field.default is not None:
569
+ return field.default
570
+ return None
571
+
572
+
573
+ _KNOWN_ACLS = {
574
+ name: acl
575
+ for acl in get_concrete_subclasses(Acl)
576
+ if (name := _get_acl_name(acl)) is not None and name != "unknownAcl"
577
+ }
578
+
579
+
580
+ def _handle_unknown_acl(value: Any) -> Any:
581
+ if isinstance(value, dict) and isinstance(acl_name := value[ACL_NAME], str):
582
+ acl_class = _KNOWN_ACLS.get(acl_name)
583
+ if acl_class:
584
+ return TypeAdapter(acl_class).validate_python(value)
585
+ return UnknownAcl.model_validate(value)
586
+
587
+
588
+ AclType: TypeAlias = Annotated[
589
+ (
590
+ AgentsAcl
591
+ | AnalyticsAcl
592
+ | AnnotationsAcl
593
+ | AppConfigAcl
594
+ | AssetsAcl
595
+ | AuditlogAcl
596
+ | DataModelInstancesAcl
597
+ | DataModelsAcl
598
+ | DataSetsAcl
599
+ | DiagramParsingAcl
600
+ | DigitalTwinAcl
601
+ | DocumentFeedbackAcl
602
+ | DocumentPipelinesAcl
603
+ | EntityMatchingAcl
604
+ | EventsAcl
605
+ | ExperimentsAcl
606
+ | ExtractionConfigsAcl
607
+ | ExtractionPipelinesAcl
608
+ | ExtractionRunsAcl
609
+ | FilePipelinesAcl
610
+ | FilesAcl
611
+ | FunctionsAcl
612
+ | GeospatialAcl
613
+ | GeospatialCrsAcl
614
+ | GroupsAcl
615
+ | HostedExtractorsAcl
616
+ | LabelsAcl
617
+ | LegacyGenericsAcl
618
+ | LegacyModelHostingAcl
619
+ | LocationFiltersAcl
620
+ | MonitoringTasksAcl
621
+ | NotificationsAcl
622
+ | PipelinesAcl
623
+ | PostgresGatewayAcl
624
+ | ProjectsAcl
625
+ | RawAcl
626
+ | RelationshipsAcl
627
+ | RoboticsAcl
628
+ | SAPWritebackAcl
629
+ | SAPWritebackRequestsAcl
630
+ | ScheduledCalculationsAcl
631
+ | SecurityCategoriesAcl
632
+ | SeismicAcl
633
+ | SequencesAcl
634
+ | SessionsAcl
635
+ | StreamRecordsAcl
636
+ | StreamsAcl
637
+ | TemplateGroupsAcl
638
+ | TemplateInstancesAcl
639
+ | ThreeDAcl
640
+ | TimeSeriesAcl
641
+ | TimeSeriesSubscriptionsAcl
642
+ | TransformationsAcl
643
+ | TypesAcl
644
+ | UserProfilesAcl
645
+ | VideoStreamingAcl
646
+ | VisionModelAcl
647
+ | WellsAcl
648
+ | WorkflowOrchestrationAcl
649
+ | SimulatorsAcl
650
+ | UnknownAcl
651
+ ),
652
+ BeforeValidator(_handle_unknown_acl),
653
+ ]
@@ -0,0 +1,56 @@
1
+ """GroupCapability wrapper for Group capabilities.
2
+
3
+ Based on the API specification at:
4
+ https://api-docs.cognite.com/20230101/tag/Groups/operation/createGroups
5
+ """
6
+
7
+ from typing import Any
8
+
9
+ from pydantic import model_serializer, model_validator
10
+ from pydantic_core.core_schema import FieldSerializationInfo
11
+
12
+ from cognite_toolkit._cdf_tk.client._resource_base import BaseModelObject
13
+ from cognite_toolkit._cdf_tk.client.resource_classes.group._constants import ACL_NAME
14
+
15
+ from .acls import AclType
16
+
17
+
18
+ class ProjectUrlNames(BaseModelObject):
19
+ """Project URL names for cross-project capabilities."""
20
+
21
+ url_names: list[str]
22
+
23
+
24
+ class GroupCapability(BaseModelObject):
25
+ """A single capability entry containing an ACL and optional project URL names."""
26
+
27
+ acl: AclType
28
+ project_url_names: ProjectUrlNames | None = None
29
+
30
+ @model_validator(mode="before")
31
+ @classmethod
32
+ def move_acl_name(cls, value: Any) -> Any:
33
+ """Move ACL key (e.g., 'assetsAcl') to 'acl' field for API compatibility."""
34
+ if not isinstance(value, dict):
35
+ return value
36
+ if "acl" in value:
37
+ return value
38
+ acl_name = next((key for key in value if key.endswith("Acl")), None)
39
+ if acl_name is None:
40
+ return value
41
+ value_copy = value.copy()
42
+ acl_data = dict(value_copy.pop(acl_name))
43
+ acl_data[ACL_NAME] = acl_name
44
+ value_copy["acl"] = acl_data
45
+ return value_copy
46
+
47
+ # MyPy complains that info; FieldSerializationInfo is not compatible with info: Any
48
+ # It is.
49
+ @model_serializer # type: ignore[type-var]
50
+ def serialize_acl_name(self, info: FieldSerializationInfo) -> dict[str, Any]:
51
+ """Serialize 'acl' field back to its specific ACL key (e.g., 'assetsAcl') for API compatibility."""
52
+ acl_data = self.acl.model_dump(**vars(info))
53
+ output: dict[str, Any] = {self.acl.acl_name: acl_data}
54
+ if self.project_url_names is not None:
55
+ output["projectUrlNames"] = self.project_url_names.model_dump(**vars(info))
56
+ return output