cognite-toolkit 0.7.42__py3-none-any.whl → 0.7.44__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/client/_toolkit_client.py +7 -1
- cognite_toolkit/_cdf_tk/client/api/events.py +20 -2
- cognite_toolkit/_cdf_tk/client/api/filemetadata.py +145 -0
- cognite_toolkit/_cdf_tk/client/api/raw.py +174 -0
- cognite_toolkit/_cdf_tk/client/api/simulator_models.py +118 -0
- cognite_toolkit/_cdf_tk/client/api/simulators.py +8 -0
- cognite_toolkit/_cdf_tk/client/api/timeseries.py +20 -2
- cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py +2 -1
- cognite_toolkit/_cdf_tk/client/cdf_client/api.py +40 -6
- cognite_toolkit/_cdf_tk/client/data_classes/agent.py +6 -9
- cognite_toolkit/_cdf_tk/client/data_classes/annotation.py +79 -0
- cognite_toolkit/_cdf_tk/client/data_classes/asset.py +7 -14
- cognite_toolkit/_cdf_tk/client/data_classes/base.py +15 -5
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/__init__.py +164 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_constraints.py +37 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_container.py +50 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_data_model.py +73 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_data_types.py +116 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_indexes.py +26 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_instance.py +143 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_references.py +86 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_space.py +26 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_view.py +143 -0
- cognite_toolkit/_cdf_tk/client/data_classes/data_modeling/_view_property.py +152 -0
- cognite_toolkit/_cdf_tk/client/data_classes/dataset.py +35 -0
- cognite_toolkit/_cdf_tk/client/data_classes/event.py +12 -15
- cognite_toolkit/_cdf_tk/client/data_classes/extraction_pipeline.py +59 -0
- cognite_toolkit/_cdf_tk/client/data_classes/filemetadata.py +15 -19
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_destination.py +34 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_job.py +134 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_mapping.py +72 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/__init__.py +63 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_auth.py +63 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_base.py +26 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_certificate.py +20 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_eventhub.py +31 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_kafka.py +53 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_mqtt.py +36 -0
- cognite_toolkit/_cdf_tk/client/data_classes/hosted_extractor_source/_rest.py +49 -0
- cognite_toolkit/_cdf_tk/client/data_classes/identifiers.py +8 -0
- cognite_toolkit/_cdf_tk/client/data_classes/label.py +27 -0
- cognite_toolkit/_cdf_tk/client/data_classes/raw.py +3 -2
- cognite_toolkit/_cdf_tk/client/data_classes/securitycategory.py +24 -0
- cognite_toolkit/_cdf_tk/client/data_classes/sequence.py +45 -0
- cognite_toolkit/_cdf_tk/client/data_classes/simulator_model.py +50 -0
- cognite_toolkit/_cdf_tk/client/data_classes/timeseries.py +15 -18
- cognite_toolkit/_cdf_tk/client/data_classes/transformation.py +140 -0
- cognite_toolkit/_cdf_tk/client/data_classes/workflow.py +27 -0
- cognite_toolkit/_cdf_tk/client/data_classes/workflow_trigger.py +63 -0
- cognite_toolkit/_cdf_tk/client/data_classes/workflow_version.py +155 -0
- cognite_toolkit/_cdf_tk/client/testing.py +6 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +10 -7
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +4 -4
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +7 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +5 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +40 -39
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +56 -59
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +3 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +48 -47
- cognite_toolkit/_cdf_tk/resource_classes/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/resource_classes/simulator_model.py +17 -0
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +84 -71
- cognite_toolkit/_cdf_tk/storageio/_file_content.py +22 -19
- cognite_toolkit/_cdf_tk/utils/useful_types2.py +5 -3
- 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.42.dist-info → cognite_toolkit-0.7.44.dist-info}/METADATA +11 -1
- {cognite_toolkit-0.7.42.dist-info → cognite_toolkit-0.7.44.dist-info}/RECORD +72 -34
- {cognite_toolkit-0.7.42.dist-info → cognite_toolkit-0.7.44.dist-info}/WHEEL +1 -1
- {cognite_toolkit-0.7.42.dist-info → cognite_toolkit-0.7.44.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
RequestUpdateable,
|
|
6
|
+
ResponseResource,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .identifiers import ExternalId
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DataSet(BaseModelObject):
|
|
13
|
+
external_id: str | None = None
|
|
14
|
+
name: str | None = None
|
|
15
|
+
description: str | None = None
|
|
16
|
+
metadata: dict[str, str] | None = None
|
|
17
|
+
write_protected: bool = False
|
|
18
|
+
|
|
19
|
+
def as_id(self) -> ExternalId:
|
|
20
|
+
if self.external_id is None:
|
|
21
|
+
raise ValueError("Cannot convert DataSet to ExternalId when external_id is None")
|
|
22
|
+
return ExternalId(external_id=self.external_id)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DataSetRequest(DataSet, RequestUpdateable):
|
|
26
|
+
container_fields: ClassVar[frozenset[str]] = frozenset({"metadata"})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DataSetResponse(DataSet, ResponseResource[DataSetRequest]):
|
|
30
|
+
id: int
|
|
31
|
+
created_time: int
|
|
32
|
+
last_updated_time: int
|
|
33
|
+
|
|
34
|
+
def as_request_resource(self) -> DataSetRequest:
|
|
35
|
+
return DataSetRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
from typing import ClassVar
|
|
2
2
|
|
|
3
|
-
from cognite_toolkit._cdf_tk.client.data_classes.base import
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
RequestUpdateable,
|
|
6
|
+
ResponseResource,
|
|
7
|
+
)
|
|
4
8
|
|
|
5
9
|
from .identifiers import ExternalId, InternalOrExternalId
|
|
6
10
|
|
|
7
11
|
|
|
8
|
-
class
|
|
9
|
-
container_fields: ClassVar[frozenset[str]] = frozenset({"metadata", "asset_ids"})
|
|
12
|
+
class Event(BaseModelObject):
|
|
10
13
|
external_id: str | None = None
|
|
11
14
|
data_set_id: int | None = None
|
|
12
15
|
start_time: int | None = None
|
|
@@ -24,20 +27,14 @@ class EventRequest(RequestUpdateable):
|
|
|
24
27
|
return ExternalId(external_id=self.external_id)
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: str | None = None
|
|
33
|
-
subtype: str | None = None
|
|
34
|
-
description: str | None = None
|
|
35
|
-
metadata: dict[str, str] | None = None
|
|
36
|
-
asset_ids: list[int] | None = None
|
|
37
|
-
source: str | None = None
|
|
30
|
+
class EventRequest(Event, RequestUpdateable):
|
|
31
|
+
container_fields: ClassVar[frozenset[str]] = frozenset({"metadata", "asset_ids"})
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class EventResponse(Event, ResponseResource[EventRequest]):
|
|
38
35
|
id: int
|
|
39
36
|
created_time: int
|
|
40
37
|
last_updated_time: int
|
|
41
38
|
|
|
42
39
|
def as_request_resource(self) -> EventRequest:
|
|
43
|
-
return EventRequest.model_validate(self.dump())
|
|
40
|
+
return EventRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
RequestUpdateable,
|
|
6
|
+
ResponseResource,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .identifiers import ExternalId
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RawTable(BaseModelObject):
|
|
13
|
+
db_name: str
|
|
14
|
+
table_name: str
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Contact(BaseModelObject):
|
|
18
|
+
name: str | None = None
|
|
19
|
+
email: str | None = None
|
|
20
|
+
role: str | None = None
|
|
21
|
+
send_notification: bool | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class NotificationConfig(BaseModelObject):
|
|
25
|
+
allowed_not_seen_range_in_minutes: int | None = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ExtractionPipeline(BaseModelObject):
|
|
29
|
+
external_id: str
|
|
30
|
+
name: str
|
|
31
|
+
description: str | None = None
|
|
32
|
+
data_set_id: int
|
|
33
|
+
raw_tables: list[RawTable] | None = None
|
|
34
|
+
schedule: str | None = None
|
|
35
|
+
contacts: list[Contact] | None = None
|
|
36
|
+
metadata: dict[str, str] | None = None
|
|
37
|
+
source: str | None = None
|
|
38
|
+
documentation: str | None = None
|
|
39
|
+
notification_config: NotificationConfig | None = None
|
|
40
|
+
created_by: str | None = None
|
|
41
|
+
|
|
42
|
+
def as_id(self) -> ExternalId:
|
|
43
|
+
return ExternalId(external_id=self.external_id)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ExtractionPipelineRequest(ExtractionPipeline, RequestUpdateable):
|
|
47
|
+
container_fields: ClassVar[frozenset[str]] = frozenset({"raw_tables", "contacts", "metadata"})
|
|
48
|
+
non_nullable_fields: ClassVar[frozenset[str]] = frozenset(
|
|
49
|
+
{"documentation", "source", "notification_config", "schedule", "description"}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ExtractionPipelineResponse(ExtractionPipeline, ResponseResource[ExtractionPipelineRequest]):
|
|
54
|
+
id: int
|
|
55
|
+
created_time: int
|
|
56
|
+
last_updated_time: int
|
|
57
|
+
|
|
58
|
+
def as_request_resource(self) -> ExtractionPipelineRequest:
|
|
59
|
+
return ExtractionPipelineRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
from typing import ClassVar, Literal
|
|
2
2
|
|
|
3
|
-
from pydantic import JsonValue
|
|
3
|
+
from pydantic import Field, JsonValue
|
|
4
4
|
|
|
5
|
-
from cognite_toolkit._cdf_tk.client.data_classes.base import RequestUpdateable, ResponseResource
|
|
5
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import BaseModelObject, RequestUpdateable, ResponseResource
|
|
6
6
|
|
|
7
7
|
from .identifiers import ExternalId
|
|
8
8
|
from .instance_api import NodeReference
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
12
|
-
container_fields: ClassVar[frozenset[str]] = frozenset({"metadata", "labels", "asset_ids", "security_categories"})
|
|
13
|
-
non_nullable_fields: ClassVar[frozenset[str]] = frozenset({"asset_ids", "security_categories"})
|
|
11
|
+
class FileMetadata(BaseModelObject):
|
|
14
12
|
external_id: str | None = None
|
|
15
13
|
name: str
|
|
16
14
|
directory: str | None = None
|
|
@@ -31,26 +29,24 @@ class FileMetadataRequest(RequestUpdateable):
|
|
|
31
29
|
return ExternalId(external_id=self.external_id)
|
|
32
30
|
|
|
33
31
|
|
|
34
|
-
class
|
|
32
|
+
class FileMetadataRequest(FileMetadata, RequestUpdateable):
|
|
33
|
+
container_fields: ClassVar[frozenset[str]] = frozenset({"metadata", "labels", "asset_ids", "security_categories"})
|
|
34
|
+
non_nullable_fields: ClassVar[frozenset[str]] = frozenset({"asset_ids", "security_categories"})
|
|
35
|
+
# This field is not part of the request when creating or updating a resource
|
|
36
|
+
# but we added it here for convenience so that it is available when converting
|
|
37
|
+
# from response to request.
|
|
38
|
+
instance_id: NodeReference | None = Field(default=None, exclude=True)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class FileMetadataResponse(FileMetadata, ResponseResource[FileMetadataRequest]):
|
|
35
42
|
created_time: int
|
|
36
43
|
last_updated_time: int
|
|
37
44
|
uploaded_time: int | None = None
|
|
38
45
|
uploaded: bool
|
|
39
46
|
id: int
|
|
40
|
-
external_id: str | None = None
|
|
41
|
-
name: str
|
|
42
|
-
directory: str | None = None
|
|
43
47
|
instance_id: NodeReference | None = None
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
metadata: dict[str, str] | None = None
|
|
47
|
-
asset_ids: list[int] | None = None
|
|
48
|
-
data_set_id: int | None = None
|
|
49
|
-
labels: list[dict[Literal["externalId"], str]] | None = None
|
|
50
|
-
geo_location: JsonValue | None = None
|
|
51
|
-
source_created_time: int | None = None
|
|
52
|
-
source_modified_time: int | None = None
|
|
53
|
-
security_categories: list[int] | None = None
|
|
48
|
+
# This field is required in the upload endpoint response, but not in any other file metadata response
|
|
49
|
+
upload_url: str | None = None
|
|
54
50
|
|
|
55
51
|
def as_request_resource(self) -> FileMetadataRequest:
|
|
56
52
|
return FileMetadataRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
2
|
+
BaseModelObject,
|
|
3
|
+
RequestUpdateable,
|
|
4
|
+
ResponseResource,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from .identifiers import ExternalId
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Credentials(BaseModelObject):
|
|
11
|
+
nonce: str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class HostedExtractorDestination(BaseModelObject):
|
|
15
|
+
external_id: str
|
|
16
|
+
target_data_set_id: int | None = None
|
|
17
|
+
|
|
18
|
+
def as_id(self) -> ExternalId:
|
|
19
|
+
return ExternalId(external_id=self.external_id)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class HostedExtractorDestinationRequest(HostedExtractorDestination, RequestUpdateable):
|
|
23
|
+
credentials: Credentials | None = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class HostedExtractorDestinationResponse(
|
|
27
|
+
HostedExtractorDestination, ResponseResource[HostedExtractorDestinationRequest]
|
|
28
|
+
):
|
|
29
|
+
session_id: int | None = None
|
|
30
|
+
created_time: int
|
|
31
|
+
last_updated_time: int
|
|
32
|
+
|
|
33
|
+
def as_request_resource(self) -> HostedExtractorDestinationRequest:
|
|
34
|
+
return HostedExtractorDestinationRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
from typing import Annotated, Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, JsonValue
|
|
4
|
+
|
|
5
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
6
|
+
BaseModelObject,
|
|
7
|
+
RequestUpdateable,
|
|
8
|
+
ResponseResource,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
from .identifiers import ExternalId
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class JobFormatDefinition(BaseModelObject):
|
|
15
|
+
type: str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PrefixConfig(BaseModelObject):
|
|
19
|
+
from_topic: bool | None = None
|
|
20
|
+
prefix: str | None = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SpaceRef(BaseModelObject):
|
|
24
|
+
space: str
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CogniteFormat(JobFormatDefinition):
|
|
28
|
+
type: Literal["cognite"] = "cognite"
|
|
29
|
+
encoding: str | None = None
|
|
30
|
+
compression: str | None = None
|
|
31
|
+
prefix: PrefixConfig | None = None
|
|
32
|
+
data_models: list[SpaceRef] | None = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class CustomFormat(JobFormatDefinition):
|
|
36
|
+
type: Literal["custom"] = "custom"
|
|
37
|
+
encoding: str | None = None
|
|
38
|
+
compression: str | None = None
|
|
39
|
+
mapping_id: str
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class RockwellFormat(JobFormatDefinition):
|
|
43
|
+
type: Literal["rockwell"] = "rockwell"
|
|
44
|
+
encoding: str | None = None
|
|
45
|
+
compression: str | None = None
|
|
46
|
+
prefix: PrefixConfig | None = None
|
|
47
|
+
data_models: list[SpaceRef] | None = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ValueFormat(JobFormatDefinition):
|
|
51
|
+
type: Literal["value"] = "value"
|
|
52
|
+
encoding: str | None = None
|
|
53
|
+
compression: str | None = None
|
|
54
|
+
prefix: PrefixConfig | None = None
|
|
55
|
+
data_models: list[SpaceRef] | None = None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
JobFormat = Annotated[
|
|
59
|
+
CogniteFormat | CustomFormat | RockwellFormat | ValueFormat,
|
|
60
|
+
Field(discriminator="type"),
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class IncrementalLoadDefinition(BaseModelObject):
|
|
65
|
+
type: str
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class BodyIncrementalLoad(IncrementalLoadDefinition):
|
|
69
|
+
type: Literal["body"] = "body"
|
|
70
|
+
value: str
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class NextUrlIncrementalLoad(IncrementalLoadDefinition):
|
|
74
|
+
type: Literal["nextUrl"] = "nextUrl"
|
|
75
|
+
value: str
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class HeaderIncrementalLoad(IncrementalLoadDefinition):
|
|
79
|
+
type: Literal["headerValue"] = "headerValue"
|
|
80
|
+
key: str
|
|
81
|
+
value: str
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class QueryParamIncrementalLoad(IncrementalLoadDefinition):
|
|
85
|
+
type: Literal["queryParam"] = "queryParam"
|
|
86
|
+
key: str
|
|
87
|
+
value: str
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class MQTTConfig(BaseModelObject):
|
|
91
|
+
topic_filter: str
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class KafkaConfig(BaseModelObject):
|
|
95
|
+
topic: str
|
|
96
|
+
partitions: int | None = None
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class RestConfig(BaseModelObject):
|
|
100
|
+
interval: Literal["5m", "15m", "1h", "6h", "12h", "1d"]
|
|
101
|
+
path: str
|
|
102
|
+
method: Literal["get", "post"] | None = None
|
|
103
|
+
body: JsonValue | None = None
|
|
104
|
+
query: dict[str, str] | None = None
|
|
105
|
+
headers: dict[str, str] | None = None
|
|
106
|
+
incremental_load: BodyIncrementalLoad | HeaderIncrementalLoad | QueryParamIncrementalLoad | None = Field(
|
|
107
|
+
None, discriminator="type"
|
|
108
|
+
)
|
|
109
|
+
pagination: (
|
|
110
|
+
BodyIncrementalLoad | NextUrlIncrementalLoad | HeaderIncrementalLoad | QueryParamIncrementalLoad | None
|
|
111
|
+
) = Field(None, discriminator="type")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class HostedExtractorJob(BaseModelObject):
|
|
115
|
+
external_id: str
|
|
116
|
+
destination_id: str
|
|
117
|
+
source_id: str
|
|
118
|
+
format: JobFormat
|
|
119
|
+
config: MQTTConfig | KafkaConfig | RestConfig
|
|
120
|
+
|
|
121
|
+
def as_id(self) -> ExternalId:
|
|
122
|
+
return ExternalId(external_id=self.external_id)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class HostedExtractorJobRequest(HostedExtractorJob, RequestUpdateable): ...
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class HostedExtractorJobResponse(HostedExtractorJob, ResponseResource[HostedExtractorJobRequest]):
|
|
129
|
+
status: str | None = None
|
|
130
|
+
created_time: int
|
|
131
|
+
last_updated_time: int
|
|
132
|
+
|
|
133
|
+
def as_request_resource(self) -> HostedExtractorJobRequest:
|
|
134
|
+
return HostedExtractorJobRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from typing import Annotated, Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
6
|
+
BaseModelObject,
|
|
7
|
+
RequestUpdateable,
|
|
8
|
+
ResponseResource,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
from .identifiers import ExternalId
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Mapping(BaseModelObject):
|
|
15
|
+
expression: str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class MappingInputDefinition(BaseModelObject):
|
|
19
|
+
type: str
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ProtobufFile(BaseModelObject):
|
|
23
|
+
file_name: str
|
|
24
|
+
content: str
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ProtobufInput(BaseModelObject):
|
|
28
|
+
type: Literal["protobuf"] = "protobuf"
|
|
29
|
+
message_name: str
|
|
30
|
+
files: list[ProtobufFile]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CSVInput(BaseModelObject):
|
|
34
|
+
type: Literal["csv"] = "csv"
|
|
35
|
+
delimiter: str = ","
|
|
36
|
+
custom_keys: list[str] | None = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class XMLInput(BaseModelObject):
|
|
40
|
+
type: Literal["xml"] = "xml"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class JSONInput(BaseModelObject):
|
|
44
|
+
type: Literal["json"] = "json"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
MappingInput = Annotated[
|
|
48
|
+
ProtobufInput | CSVInput | XMLInput | JSONInput,
|
|
49
|
+
Field(discriminator="type"),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class HostedExtractorMapping(BaseModelObject):
|
|
54
|
+
external_id: str
|
|
55
|
+
mapping: Mapping
|
|
56
|
+
published: bool
|
|
57
|
+
|
|
58
|
+
def as_id(self) -> ExternalId:
|
|
59
|
+
return ExternalId(external_id=self.external_id)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class HostedExtractorMappingRequest(HostedExtractorMapping, RequestUpdateable):
|
|
63
|
+
input: MappingInput | None = None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class HostedExtractorMappingResponse(HostedExtractorMapping, ResponseResource[HostedExtractorMappingRequest]):
|
|
67
|
+
input: MappingInput
|
|
68
|
+
created_time: int
|
|
69
|
+
last_updated_time: int
|
|
70
|
+
|
|
71
|
+
def as_request_resource(self) -> HostedExtractorMappingRequest:
|
|
72
|
+
return HostedExtractorMappingRequest.model_validate(self.dump(), extra="ignore")
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, TypeAdapter
|
|
4
|
+
|
|
5
|
+
from ._auth import (
|
|
6
|
+
BasicAuthenticationRequest,
|
|
7
|
+
BasicAuthenticationResponse,
|
|
8
|
+
ClientCredentialAuthenticationRequest,
|
|
9
|
+
ClientCredentialAuthenticationResponse,
|
|
10
|
+
HTTPBasicAuthenticationRequest,
|
|
11
|
+
HTTPBasicAuthenticationResponse,
|
|
12
|
+
ScramShaAuthenticationRequest,
|
|
13
|
+
ScramShaAuthenticationResponse,
|
|
14
|
+
)
|
|
15
|
+
from ._certificate import AuthCertificateRequest, CACertificateRequest, CertificateResponse
|
|
16
|
+
from ._eventhub import EventHubSourceRequest, EventHubSourceResponse
|
|
17
|
+
from ._kafka import KafkaBroker, KafkaSourceRequest, KafkaSourceResponse
|
|
18
|
+
from ._mqtt import MQTTSourceRequest, MQTTSourceResponse
|
|
19
|
+
from ._rest import RESTSourceRequest, RESTSourceResponse
|
|
20
|
+
|
|
21
|
+
HostedExtractorSourceRequestUnion = Annotated[
|
|
22
|
+
KafkaSourceRequest | EventHubSourceRequest | MQTTSourceRequest | RESTSourceRequest,
|
|
23
|
+
Field(discriminator="type"),
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
HostedExtractorSourceRequest: TypeAdapter[HostedExtractorSourceRequestUnion] = TypeAdapter(
|
|
27
|
+
HostedExtractorSourceRequestUnion
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
HostedExtractorSourceResponseUnion = Annotated[
|
|
31
|
+
KafkaSourceResponse | EventHubSourceResponse | MQTTSourceResponse | RESTSourceResponse,
|
|
32
|
+
Field(discriminator="type"),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
HostedExtractorSourceResponse: TypeAdapter[HostedExtractorSourceResponseUnion] = TypeAdapter(
|
|
36
|
+
HostedExtractorSourceResponseUnion
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"AuthCertificateRequest",
|
|
42
|
+
"BasicAuthenticationRequest",
|
|
43
|
+
"BasicAuthenticationResponse",
|
|
44
|
+
"CACertificateRequest",
|
|
45
|
+
"CertificateResponse",
|
|
46
|
+
"ClientCredentialAuthenticationRequest",
|
|
47
|
+
"ClientCredentialAuthenticationResponse",
|
|
48
|
+
"EventHubSourceRequest",
|
|
49
|
+
"EventHubSourceResponse",
|
|
50
|
+
"HTTPBasicAuthenticationRequest",
|
|
51
|
+
"HTTPBasicAuthenticationResponse",
|
|
52
|
+
"HostedExtractorSourceRequest",
|
|
53
|
+
"HostedExtractorSourceResponse",
|
|
54
|
+
"KafkaBroker",
|
|
55
|
+
"KafkaSourceRequest",
|
|
56
|
+
"KafkaSourceResponse",
|
|
57
|
+
"MQTTSourceRequest",
|
|
58
|
+
"MQTTSourceResponse",
|
|
59
|
+
"RESTSourceRequest",
|
|
60
|
+
"RESTSourceResponse",
|
|
61
|
+
"ScramShaAuthenticationRequest",
|
|
62
|
+
"ScramShaAuthenticationResponse",
|
|
63
|
+
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AuthenticationRequestDefinition(BaseModelObject):
|
|
9
|
+
type: str
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AuthenticationResponseDefinition(BaseModelObject):
|
|
13
|
+
type: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class BasicAuthentication(BaseModelObject):
|
|
17
|
+
type: Literal["basic"] = "basic"
|
|
18
|
+
username: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BasicAuthenticationRequest(BasicAuthentication, AuthenticationRequestDefinition):
|
|
22
|
+
password: str | None = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class BasicAuthenticationResponse(BasicAuthentication, AuthenticationResponseDefinition): ...
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ClientCredentialAuthentication(BaseModelObject):
|
|
29
|
+
type: Literal["clientCredential"] = "clientCredential"
|
|
30
|
+
client_id: str
|
|
31
|
+
token_url: str
|
|
32
|
+
scopes: str
|
|
33
|
+
default_expires_in: str | None = None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ClientCredentialAuthenticationRequest(ClientCredentialAuthentication, AuthenticationRequestDefinition):
|
|
37
|
+
client_secret: str
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ClientCredentialAuthenticationResponse(ClientCredentialAuthentication, AuthenticationResponseDefinition): ...
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ScramShaAuthentication(BaseModelObject):
|
|
44
|
+
type: Literal["scramSha256", "scramSha512"]
|
|
45
|
+
username: str
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ScramShaAuthenticationRequest(ScramShaAuthentication, AuthenticationRequestDefinition):
|
|
49
|
+
password: str
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ScramShaAuthenticationResponse(ScramShaAuthentication, AuthenticationResponseDefinition): ...
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class HTTPBasicAuthenticationRequest(AuthenticationRequestDefinition):
|
|
56
|
+
type: Literal["header", "query"]
|
|
57
|
+
key: str
|
|
58
|
+
value: str
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class HTTPBasicAuthenticationResponse(AuthenticationResponseDefinition):
|
|
62
|
+
type: Literal["header", "query"]
|
|
63
|
+
key: str
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Any, Literal
|
|
2
|
+
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
RequestUpdateable,
|
|
6
|
+
)
|
|
7
|
+
from cognite_toolkit._cdf_tk.client.data_classes.identifiers import ExternalId
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SourceRequestDefinition(RequestUpdateable):
|
|
11
|
+
type: str
|
|
12
|
+
external_id: str
|
|
13
|
+
|
|
14
|
+
def as_id(self) -> ExternalId:
|
|
15
|
+
return ExternalId(external_id=self.external_id)
|
|
16
|
+
|
|
17
|
+
def as_update(self, mode: Literal["patch", "replace"]) -> dict[str, Any]:
|
|
18
|
+
output = super().as_update(mode)
|
|
19
|
+
output["type"] = self.type
|
|
20
|
+
return output
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SourceResponseDefinition(BaseModelObject):
|
|
24
|
+
external_id: str
|
|
25
|
+
created_time: int
|
|
26
|
+
last_updated_time: int
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
2
|
+
BaseModelObject,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CACertificateRequest(BaseModelObject):
|
|
7
|
+
type: str
|
|
8
|
+
certificate: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AuthCertificateRequest(BaseModelObject):
|
|
12
|
+
key: str
|
|
13
|
+
key_password: str | None = None
|
|
14
|
+
type: str
|
|
15
|
+
certificate: str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CertificateResponse(BaseModelObject):
|
|
19
|
+
thumbprint: str
|
|
20
|
+
expires_at: int
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from cognite_toolkit._cdf_tk.client.data_classes.base import (
|
|
4
|
+
BaseModelObject,
|
|
5
|
+
ResponseResource,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from ._auth import BasicAuthenticationRequest, BasicAuthenticationResponse
|
|
9
|
+
from ._base import SourceRequestDefinition, SourceResponseDefinition
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EventHubSource(BaseModelObject):
|
|
13
|
+
type: Literal["eventHub"] = "eventHub"
|
|
14
|
+
host: str
|
|
15
|
+
event_hub_name: str
|
|
16
|
+
consumer_group: str | None = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class EventHubSourceRequest(EventHubSource, SourceRequestDefinition):
|
|
20
|
+
authentication: BasicAuthenticationRequest | None = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class EventHubSourceResponse(
|
|
24
|
+
SourceResponseDefinition,
|
|
25
|
+
EventHubSource,
|
|
26
|
+
ResponseResource[EventHubSourceRequest],
|
|
27
|
+
):
|
|
28
|
+
authentication: BasicAuthenticationResponse | None = None
|
|
29
|
+
|
|
30
|
+
def as_request_resource(self) -> EventHubSourceRequest:
|
|
31
|
+
return EventHubSourceRequest.model_validate(self.dump(), extra="ignore")
|