cognite-toolkit 0.7.59__py3-none-any.whl → 0.7.60__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.
- cognite_toolkit/_cdf_tk/apps/_dump_app.py +53 -0
- cognite_toolkit/_cdf_tk/commands/dump_resource.py +41 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.59.dist-info → cognite_toolkit-0.7.60.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.7.59.dist-info → cognite_toolkit-0.7.60.dist-info}/RECORD +10 -10
- {cognite_toolkit-0.7.59.dist-info → cognite_toolkit-0.7.60.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.7.59.dist-info → cognite_toolkit-0.7.60.dist-info}/entry_points.txt +0 -0
|
@@ -17,6 +17,7 @@ from cognite_toolkit._cdf_tk.commands.dump_resource import (
|
|
|
17
17
|
GroupFinder,
|
|
18
18
|
LocationFilterFinder,
|
|
19
19
|
NodeFinder,
|
|
20
|
+
ResourceViewMappingFinder,
|
|
20
21
|
SearchConfigFinder,
|
|
21
22
|
SpaceFinder,
|
|
22
23
|
StreamlitFinder,
|
|
@@ -52,6 +53,8 @@ class DumpApp(typer.Typer):
|
|
|
52
53
|
self.command("agents")(DumpConfigApp.dump_agents)
|
|
53
54
|
|
|
54
55
|
self.command("search-config")(DumpConfigApp.dump_search_config)
|
|
56
|
+
if Flags.MIGRATE.is_enabled():
|
|
57
|
+
self.command("resource-view-mapping")(DumpConfigApp.dump_resource_view_mapping)
|
|
55
58
|
|
|
56
59
|
@staticmethod
|
|
57
60
|
def dump_main(ctx: typer.Context) -> None:
|
|
@@ -79,6 +82,8 @@ class DumpConfigApp(typer.Typer):
|
|
|
79
82
|
self.command("streamlit")(DumpConfigApp.dump_streamlit)
|
|
80
83
|
self.command("agents")(self.dump_agents)
|
|
81
84
|
self.command("search-config")(self.dump_search_config)
|
|
85
|
+
if Flags.MIGRATE.is_enabled():
|
|
86
|
+
self.command("resource-view-mapping")(self.dump_resource_view_mapping)
|
|
82
87
|
|
|
83
88
|
@staticmethod
|
|
84
89
|
def dump_config_main(ctx: typer.Context) -> None:
|
|
@@ -758,6 +763,54 @@ class DumpConfigApp(typer.Typer):
|
|
|
758
763
|
)
|
|
759
764
|
)
|
|
760
765
|
|
|
766
|
+
@staticmethod
|
|
767
|
+
def dump_resource_view_mapping(
|
|
768
|
+
ctx: typer.Context,
|
|
769
|
+
external_id: Annotated[
|
|
770
|
+
list[str] | None,
|
|
771
|
+
typer.Argument(
|
|
772
|
+
help="The external ID(s) of the resource view mapping(s) you want to dump. "
|
|
773
|
+
"If nothing is provided, an interactive prompt will be shown to select the resource view mappings.",
|
|
774
|
+
),
|
|
775
|
+
] = None,
|
|
776
|
+
output_dir: Annotated[
|
|
777
|
+
Path,
|
|
778
|
+
typer.Option(
|
|
779
|
+
"--output-dir",
|
|
780
|
+
"-o",
|
|
781
|
+
help="Where to dump the resource view mapping files.",
|
|
782
|
+
allow_dash=True,
|
|
783
|
+
),
|
|
784
|
+
] = Path("tmp"),
|
|
785
|
+
clean: Annotated[
|
|
786
|
+
bool,
|
|
787
|
+
typer.Option(
|
|
788
|
+
"--clean",
|
|
789
|
+
"-c",
|
|
790
|
+
help="Delete the output directory before dumping the resource view mappings.",
|
|
791
|
+
),
|
|
792
|
+
] = False,
|
|
793
|
+
verbose: Annotated[
|
|
794
|
+
bool,
|
|
795
|
+
typer.Option(
|
|
796
|
+
"--verbose",
|
|
797
|
+
"-v",
|
|
798
|
+
help="Turn on to get more verbose output when running the command",
|
|
799
|
+
),
|
|
800
|
+
] = False,
|
|
801
|
+
) -> None:
|
|
802
|
+
"""[MIGRATION] This command will dump the selected resource view mapping(s) as yaml to the folder specified, defaults to /tmp."""
|
|
803
|
+
client = EnvironmentVariables.create_from_environment().get_client()
|
|
804
|
+
cmd = DumpResourceCommand(client=client)
|
|
805
|
+
cmd.run(
|
|
806
|
+
lambda: cmd.dump_to_yamls(
|
|
807
|
+
ResourceViewMappingFinder(client, tuple(external_id) if external_id else None),
|
|
808
|
+
output_dir=output_dir,
|
|
809
|
+
clean=clean,
|
|
810
|
+
verbose=verbose,
|
|
811
|
+
)
|
|
812
|
+
)
|
|
813
|
+
|
|
761
814
|
|
|
762
815
|
class DumpDataApp(typer.Typer):
|
|
763
816
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
@@ -28,7 +28,7 @@ from cognite.client.data_classes._base import (
|
|
|
28
28
|
from cognite.client.data_classes.agents import (
|
|
29
29
|
AgentList,
|
|
30
30
|
)
|
|
31
|
-
from cognite.client.data_classes.data_modeling import DataModelId
|
|
31
|
+
from cognite.client.data_classes.data_modeling import DataModelId, NodeList
|
|
32
32
|
from cognite.client.data_classes.documents import SourceFileProperty
|
|
33
33
|
from cognite.client.data_classes.extractionpipelines import ExtractionPipelineConfigList
|
|
34
34
|
from cognite.client.data_classes.functions import (
|
|
@@ -53,6 +53,7 @@ from rich.panel import Panel
|
|
|
53
53
|
|
|
54
54
|
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
55
55
|
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.location_filters import LocationFilterList
|
|
56
|
+
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.migration import ResourceViewMapping
|
|
56
57
|
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.search_config import SearchConfigList
|
|
57
58
|
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.search_config import ViewId as SearchConfigViewId
|
|
58
59
|
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.streamlit_ import Streamlit, StreamlitList
|
|
@@ -69,6 +70,7 @@ from cognite_toolkit._cdf_tk.cruds import (
|
|
|
69
70
|
LocationFilterCRUD,
|
|
70
71
|
NodeCRUD,
|
|
71
72
|
ResourceCRUD,
|
|
73
|
+
ResourceViewMappingCRUD,
|
|
72
74
|
SearchConfigCRUD,
|
|
73
75
|
SpaceCRUD,
|
|
74
76
|
StreamlitCRUD,
|
|
@@ -797,6 +799,44 @@ class SearchConfigFinder(ResourceFinder[tuple[SearchConfigViewId, ...]]):
|
|
|
797
799
|
yield list(self.identifier), None, loader, None
|
|
798
800
|
|
|
799
801
|
|
|
802
|
+
class ResourceViewMappingFinder(ResourceFinder[tuple[str, ...]]):
|
|
803
|
+
def __init__(self, client: ToolkitClient, identifier: tuple[str, ...] | None = None):
|
|
804
|
+
super().__init__(client, identifier)
|
|
805
|
+
self.resource_view_mappings: list[ResourceViewMapping] | None = None
|
|
806
|
+
|
|
807
|
+
def _interactive_select(self) -> tuple[str, ...]:
|
|
808
|
+
mappings = self.client.migration.resource_view_mapping.list(limit=-1)
|
|
809
|
+
if not mappings:
|
|
810
|
+
raise ToolkitMissingResourceError("No resource view mappings found")
|
|
811
|
+
self.resource_view_mappings = list(mappings)
|
|
812
|
+
choices = [
|
|
813
|
+
Choice(
|
|
814
|
+
f"{mapping.external_id} ({mapping.resource_type} -> {mapping.view_id.external_id})",
|
|
815
|
+
value=mapping.external_id,
|
|
816
|
+
)
|
|
817
|
+
for mapping in sorted(mappings, key=lambda m: m.external_id)
|
|
818
|
+
]
|
|
819
|
+
selected_ids: list[str] | None = questionary.checkbox(
|
|
820
|
+
"Which resource view mapping(s) would you like to dump?",
|
|
821
|
+
choices=choices,
|
|
822
|
+
validate=lambda choices: True if choices else "You must select at least one resource view mapping.",
|
|
823
|
+
).unsafe_ask()
|
|
824
|
+
if not selected_ids:
|
|
825
|
+
raise ToolkitValueError(f"No resource view mappings selected for dumping.{_INTERACTIVE_SELECT_HELPER_TEXT}")
|
|
826
|
+
return tuple(selected_ids)
|
|
827
|
+
|
|
828
|
+
def __iter__(self) -> Iterator[tuple[list[Hashable], CogniteResourceList | None, ResourceCRUD, None | str]]:
|
|
829
|
+
self.identifier = self._selected()
|
|
830
|
+
loader = ResourceViewMappingCRUD.create_loader(self.client)
|
|
831
|
+
if self.resource_view_mappings:
|
|
832
|
+
selected_mappings = NodeList[ResourceViewMapping](
|
|
833
|
+
[m for m in self.resource_view_mappings if m.external_id in self.identifier]
|
|
834
|
+
)
|
|
835
|
+
yield [], selected_mappings, loader, None
|
|
836
|
+
else:
|
|
837
|
+
yield list(self.identifier), None, loader, None
|
|
838
|
+
|
|
839
|
+
|
|
800
840
|
class DumpResourceCommand(ToolkitCommand):
|
|
801
841
|
def dump_to_yamls(
|
|
802
842
|
self,
|
cognite_toolkit/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.7.
|
|
1
|
+
__version__ = "0.7.60"
|
|
@@ -7,7 +7,7 @@ cognite_toolkit/_cdf_tk/apps/_core_app.py,sha256=ogHzZCTILj6bHQn0GmLZRKldFHlxL33
|
|
|
7
7
|
cognite_toolkit/_cdf_tk/apps/_data_app.py,sha256=LeplXlxXtyIymRPgbatQrRFodU4VZBFxI0bqDutLSbg,806
|
|
8
8
|
cognite_toolkit/_cdf_tk/apps/_dev_app.py,sha256=zae8O55y4Gp-I1DLqh_yCRbRPOa-OlSVqXgrx_w-UV0,3313
|
|
9
9
|
cognite_toolkit/_cdf_tk/apps/_download_app.py,sha256=Iw-q4lIMagFQ7b8RVRubUQNAPbqFKP2NmPi30yI7qG0,40455
|
|
10
|
-
cognite_toolkit/_cdf_tk/apps/_dump_app.py,sha256=
|
|
10
|
+
cognite_toolkit/_cdf_tk/apps/_dump_app.py,sha256=8Z0D2snV48FC5eMBYJQ9fDnaNQCII3yrgrGolRtSOSc,39325
|
|
11
11
|
cognite_toolkit/_cdf_tk/apps/_import_app.py,sha256=5n5AF40HJ0Q_3LENCknG0MxH4pMUS8OwsqvtCYj_t7w,2086
|
|
12
12
|
cognite_toolkit/_cdf_tk/apps/_landing_app.py,sha256=qZqO0qN33-6TTF9O4fYuNF6zhJH-QyUWsuElWr8sH6w,1365
|
|
13
13
|
cognite_toolkit/_cdf_tk/apps/_migrate_app.py,sha256=X_HZ0wmRlL9-iuEZ5lZszEl-BwkzdyCKuTNbQ_qnWz8,47296
|
|
@@ -253,7 +253,7 @@ cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py,sha256=4tNKk
|
|
|
253
253
|
cognite_toolkit/_cdf_tk/commands/clean.py,sha256=bsrT-W__Vd4c9rbGC8p-KosdcdH7519ipIwad1dpuqo,16716
|
|
254
254
|
cognite_toolkit/_cdf_tk/commands/collect.py,sha256=zBMKhhvjOpuASMnwP0eeHRI02tANcvFEZgv0CQO1ECc,627
|
|
255
255
|
cognite_toolkit/_cdf_tk/commands/deploy.py,sha256=GhVHFXbuAdMM_ax0wU-c8ALlkmU2DyEHoqIP7xpE1XQ,23354
|
|
256
|
-
cognite_toolkit/_cdf_tk/commands/dump_resource.py,sha256=
|
|
256
|
+
cognite_toolkit/_cdf_tk/commands/dump_resource.py,sha256=V6SRvzBur-P946PoZDMF2pxQ9wo2H-KvpfAHHDzIGrg,42926
|
|
257
257
|
cognite_toolkit/_cdf_tk/commands/init.py,sha256=og4PDPkRmjJ1sLq6cZ1Ozk6m7XnQPcE4I4RBtyrA0Yc,9427
|
|
258
258
|
cognite_toolkit/_cdf_tk/commands/modules.py,sha256=9s9pMHT6ySoO5TXBmG8Qe7z_iQka4ctLSE_wpf191MU,41447
|
|
259
259
|
cognite_toolkit/_cdf_tk/commands/pull.py,sha256=p2Per2Wpb5FmZU1qlsU1V-4PHWWbbLhkyv1XiAdDUSA,44086
|
|
@@ -432,13 +432,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
|
|
|
432
432
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
|
|
433
433
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
|
|
434
434
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
|
|
435
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=
|
|
436
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=
|
|
437
|
-
cognite_toolkit/_resources/cdf.toml,sha256=
|
|
438
|
-
cognite_toolkit/_version.py,sha256=
|
|
435
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=IaQ-Z7WcOSO1MBiqG4R_RnFKK3egcpV-etbbgslJDBw,667
|
|
436
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=y3VQL0JlzWQMjudfZSX9EMcx4EscgEQXD2uCTSS9Hu0,2430
|
|
437
|
+
cognite_toolkit/_resources/cdf.toml,sha256=w078At6q9-z6dYhPwFnBveWZsyJq2nO9Gf-AZwrV_i0,475
|
|
438
|
+
cognite_toolkit/_version.py,sha256=OD9is93QVR83jKhdg4JiAv63SOR_32toBDAsTuloB6o,23
|
|
439
439
|
cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
|
|
440
440
|
cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
|
|
441
|
-
cognite_toolkit-0.7.
|
|
442
|
-
cognite_toolkit-0.7.
|
|
443
|
-
cognite_toolkit-0.7.
|
|
444
|
-
cognite_toolkit-0.7.
|
|
441
|
+
cognite_toolkit-0.7.60.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
|
|
442
|
+
cognite_toolkit-0.7.60.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
|
|
443
|
+
cognite_toolkit-0.7.60.dist-info/METADATA,sha256=baWSItas1tNH2vLmN58Vdxaaag-UrGqEwLXpjda_kMY,5026
|
|
444
|
+
cognite_toolkit-0.7.60.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|