cartography 0.105.0__py3-none-any.whl → 0.106.0rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cartography might be problematic. Click here for more details.
- cartography/_version.py +2 -2
- cartography/client/core/tx.py +62 -0
- cartography/data/indexes.cypher +0 -34
- cartography/graph/cleanupbuilder.py +47 -0
- cartography/graph/job.py +42 -0
- cartography/graph/querybuilder.py +136 -2
- cartography/graph/statement.py +1 -1
- cartography/intel/aws/ecs.py +228 -380
- cartography/intel/aws/efs.py +261 -0
- cartography/intel/aws/identitycenter.py +14 -3
- cartography/intel/aws/inspector.py +96 -53
- cartography/intel/aws/rds.py +2 -1
- cartography/intel/aws/resources.py +2 -0
- cartography/intel/entra/__init__.py +11 -0
- cartography/intel/entra/applications.py +366 -0
- cartography/intel/kubernetes/__init__.py +30 -14
- cartography/intel/kubernetes/clusters.py +86 -0
- cartography/intel/kubernetes/namespaces.py +59 -57
- cartography/intel/kubernetes/pods.py +140 -77
- cartography/intel/kubernetes/secrets.py +95 -45
- cartography/intel/kubernetes/services.py +131 -67
- cartography/intel/kubernetes/util.py +125 -14
- cartography/models/aws/ecs/__init__.py +0 -0
- cartography/models/aws/ecs/clusters.py +64 -0
- cartography/models/aws/ecs/container_definitions.py +93 -0
- cartography/models/aws/ecs/container_instances.py +84 -0
- cartography/models/aws/ecs/containers.py +80 -0
- cartography/models/aws/ecs/services.py +117 -0
- cartography/models/aws/ecs/task_definitions.py +97 -0
- cartography/models/aws/ecs/tasks.py +110 -0
- cartography/models/aws/efs/__init__.py +0 -0
- cartography/models/aws/efs/access_point.py +77 -0
- cartography/models/aws/efs/file_system.py +60 -0
- cartography/models/aws/efs/mount_target.py +79 -0
- cartography/models/core/common.py +1 -0
- cartography/models/core/relationships.py +44 -0
- cartography/models/entra/app_role_assignment.py +115 -0
- cartography/models/entra/application.py +47 -0
- cartography/models/kubernetes/__init__.py +0 -0
- cartography/models/kubernetes/clusters.py +26 -0
- cartography/models/kubernetes/containers.py +108 -0
- cartography/models/kubernetes/namespaces.py +51 -0
- cartography/models/kubernetes/pods.py +80 -0
- cartography/models/kubernetes/secrets.py +79 -0
- cartography/models/kubernetes/services.py +108 -0
- cartography/util.py +15 -10
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/METADATA +1 -1
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/RECORD +52 -29
- cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/WHEEL +0 -0
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/entry_points.txt +0 -0
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.105.0.dist-info → cartography-0.106.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class ECSTaskDefinitionNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("taskDefinitionArn")
|
|
17
|
+
arn: PropertyRef = PropertyRef("taskDefinitionArn", extra_index=True)
|
|
18
|
+
family: PropertyRef = PropertyRef("family")
|
|
19
|
+
task_role_arn: PropertyRef = PropertyRef("taskRoleArn")
|
|
20
|
+
execution_role_arn: PropertyRef = PropertyRef("executionRoleArn")
|
|
21
|
+
network_mode: PropertyRef = PropertyRef("networkMode")
|
|
22
|
+
revision: PropertyRef = PropertyRef("revision")
|
|
23
|
+
status: PropertyRef = PropertyRef("status")
|
|
24
|
+
compatibilities: PropertyRef = PropertyRef("compatibilities")
|
|
25
|
+
runtime_platform_cpu_architecture: PropertyRef = PropertyRef(
|
|
26
|
+
"runtimePlatform.cpuArchitecture"
|
|
27
|
+
)
|
|
28
|
+
runtime_platform_operating_system_family: PropertyRef = PropertyRef(
|
|
29
|
+
"runtimePlatform.operatingSystemFamily"
|
|
30
|
+
)
|
|
31
|
+
requires_compatibilities: PropertyRef = PropertyRef("requiresCompatibilities")
|
|
32
|
+
cpu: PropertyRef = PropertyRef("cpu")
|
|
33
|
+
memory: PropertyRef = PropertyRef("memory")
|
|
34
|
+
pid_mode: PropertyRef = PropertyRef("pidMode")
|
|
35
|
+
ipc_mode: PropertyRef = PropertyRef("ipcMode")
|
|
36
|
+
proxy_configuration_type: PropertyRef = PropertyRef("proxyConfiguration.type")
|
|
37
|
+
proxy_configuration_container_name: PropertyRef = PropertyRef(
|
|
38
|
+
"proxyConfiguration.containerName"
|
|
39
|
+
)
|
|
40
|
+
registered_at: PropertyRef = PropertyRef("registeredAt")
|
|
41
|
+
deregistered_at: PropertyRef = PropertyRef("deregisteredAt")
|
|
42
|
+
registered_by: PropertyRef = PropertyRef("registeredBy")
|
|
43
|
+
ephemeral_storage_size_in_gib: PropertyRef = PropertyRef(
|
|
44
|
+
"ephemeralStorage.sizeInGiB"
|
|
45
|
+
)
|
|
46
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
47
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class ECSTaskDefinitionToAWSAccountRelProperties(CartographyRelProperties):
|
|
52
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class ECSTaskDefinitionToAWSAccountRel(CartographyRelSchema):
|
|
57
|
+
target_node_label: str = "AWSAccount"
|
|
58
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
59
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
|
|
60
|
+
)
|
|
61
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
62
|
+
rel_label: str = "RESOURCE"
|
|
63
|
+
properties: ECSTaskDefinitionToAWSAccountRelProperties = (
|
|
64
|
+
ECSTaskDefinitionToAWSAccountRelProperties()
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass(frozen=True)
|
|
69
|
+
class ECSTaskDefinitionToECSTaskRelProperties(CartographyRelProperties):
|
|
70
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass(frozen=True)
|
|
74
|
+
class ECSTaskDefinitionToECSTaskRel(CartographyRelSchema):
|
|
75
|
+
target_node_label: str = "ECSTask"
|
|
76
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
77
|
+
{"task_definition_arn": PropertyRef("taskDefinitionArn")}
|
|
78
|
+
)
|
|
79
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
80
|
+
rel_label: str = "HAS_TASK_DEFINITION"
|
|
81
|
+
properties: ECSTaskDefinitionToECSTaskRelProperties = (
|
|
82
|
+
ECSTaskDefinitionToECSTaskRelProperties()
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass(frozen=True)
|
|
87
|
+
class ECSTaskDefinitionSchema(CartographyNodeSchema):
|
|
88
|
+
label: str = "ECSTaskDefinition"
|
|
89
|
+
properties: ECSTaskDefinitionNodeProperties = ECSTaskDefinitionNodeProperties()
|
|
90
|
+
sub_resource_relationship: ECSTaskDefinitionToAWSAccountRel = (
|
|
91
|
+
ECSTaskDefinitionToAWSAccountRel()
|
|
92
|
+
)
|
|
93
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
94
|
+
[
|
|
95
|
+
ECSTaskDefinitionToECSTaskRel(),
|
|
96
|
+
]
|
|
97
|
+
)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class ECSTaskNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("taskArn")
|
|
17
|
+
arn: PropertyRef = PropertyRef("taskArn", extra_index=True)
|
|
18
|
+
availability_zone: PropertyRef = PropertyRef("availabilityZone")
|
|
19
|
+
capacity_provider_name: PropertyRef = PropertyRef("capacityProviderName")
|
|
20
|
+
cluster_arn: PropertyRef = PropertyRef("clusterArn")
|
|
21
|
+
connectivity: PropertyRef = PropertyRef("connectivity")
|
|
22
|
+
connectivity_at: PropertyRef = PropertyRef("connectivityAt")
|
|
23
|
+
container_instance_arn: PropertyRef = PropertyRef("containerInstanceArn")
|
|
24
|
+
cpu: PropertyRef = PropertyRef("cpu")
|
|
25
|
+
created_at: PropertyRef = PropertyRef("createdAt")
|
|
26
|
+
desired_status: PropertyRef = PropertyRef("desiredStatus")
|
|
27
|
+
enable_execute_command: PropertyRef = PropertyRef("enableExecuteCommand")
|
|
28
|
+
execution_stopped_at: PropertyRef = PropertyRef("executionStoppedAt")
|
|
29
|
+
group: PropertyRef = PropertyRef("group")
|
|
30
|
+
health_status: PropertyRef = PropertyRef("healthStatus")
|
|
31
|
+
last_status: PropertyRef = PropertyRef("lastStatus")
|
|
32
|
+
launch_type: PropertyRef = PropertyRef("launchType")
|
|
33
|
+
memory: PropertyRef = PropertyRef("memory")
|
|
34
|
+
platform_version: PropertyRef = PropertyRef("platformVersion")
|
|
35
|
+
platform_family: PropertyRef = PropertyRef("platformFamily")
|
|
36
|
+
pull_started_at: PropertyRef = PropertyRef("pullStartedAt")
|
|
37
|
+
pull_stopped_at: PropertyRef = PropertyRef("pullStoppedAt")
|
|
38
|
+
started_at: PropertyRef = PropertyRef("startedAt")
|
|
39
|
+
started_by: PropertyRef = PropertyRef("startedBy")
|
|
40
|
+
stop_code: PropertyRef = PropertyRef("stopCode")
|
|
41
|
+
stopped_at: PropertyRef = PropertyRef("stoppedAt")
|
|
42
|
+
stopped_reason: PropertyRef = PropertyRef("stoppedReason")
|
|
43
|
+
stopping_at: PropertyRef = PropertyRef("stoppingAt")
|
|
44
|
+
task_definition_arn: PropertyRef = PropertyRef("taskDefinitionArn")
|
|
45
|
+
version: PropertyRef = PropertyRef("version")
|
|
46
|
+
ephemeral_storage_size_in_gib: PropertyRef = PropertyRef(
|
|
47
|
+
"ephemeralStorage.sizeInGiB"
|
|
48
|
+
)
|
|
49
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
50
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class ECSTaskToECSClusterRelProperties(CartographyRelProperties):
|
|
55
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(frozen=True)
|
|
59
|
+
class ECSTaskToECSClusterRel(CartographyRelSchema):
|
|
60
|
+
target_node_label: str = "ECSCluster"
|
|
61
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
62
|
+
{"id": PropertyRef("ClusterArn", set_in_kwargs=True)}
|
|
63
|
+
)
|
|
64
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
65
|
+
rel_label: str = "HAS_TASK"
|
|
66
|
+
properties: ECSTaskToECSClusterRelProperties = ECSTaskToECSClusterRelProperties()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class ECSTaskToContainerInstanceRelProperties(CartographyRelProperties):
|
|
71
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class ECSTaskToContainerInstanceRel(CartographyRelSchema):
|
|
76
|
+
target_node_label: str = "ECSContainerInstance"
|
|
77
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
78
|
+
{"id": PropertyRef("containerInstanceArn")}
|
|
79
|
+
)
|
|
80
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
81
|
+
rel_label: str = "HAS_TASK"
|
|
82
|
+
properties: ECSTaskToContainerInstanceRelProperties = (
|
|
83
|
+
ECSTaskToContainerInstanceRelProperties()
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(frozen=True)
|
|
88
|
+
class ECSTaskToAWSAccountRelProperties(CartographyRelProperties):
|
|
89
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@dataclass(frozen=True)
|
|
93
|
+
class ECSTaskToAWSAccountRel(CartographyRelSchema):
|
|
94
|
+
target_node_label: str = "AWSAccount"
|
|
95
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
96
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
|
|
97
|
+
)
|
|
98
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
99
|
+
rel_label: str = "RESOURCE"
|
|
100
|
+
properties: ECSTaskToAWSAccountRelProperties = ECSTaskToAWSAccountRelProperties()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass(frozen=True)
|
|
104
|
+
class ECSTaskSchema(CartographyNodeSchema):
|
|
105
|
+
label: str = "ECSTask"
|
|
106
|
+
properties: ECSTaskNodeProperties = ECSTaskNodeProperties()
|
|
107
|
+
sub_resource_relationship: ECSTaskToAWSAccountRel = ECSTaskToAWSAccountRel()
|
|
108
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
109
|
+
[ECSTaskToContainerInstanceRel(), ECSTaskToECSClusterRel()]
|
|
110
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class EfsAccessPointNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("AccessPointArn")
|
|
17
|
+
arn: PropertyRef = PropertyRef("AccessPointArn", extra_index=True)
|
|
18
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
19
|
+
access_point_id: PropertyRef = PropertyRef("AccessPointId")
|
|
20
|
+
file_system_id: PropertyRef = PropertyRef("FileSystemId")
|
|
21
|
+
lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
|
|
22
|
+
name: PropertyRef = PropertyRef("Name")
|
|
23
|
+
owner_id: PropertyRef = PropertyRef("OwnerId")
|
|
24
|
+
posix_gid: PropertyRef = PropertyRef("Gid")
|
|
25
|
+
posix_uid: PropertyRef = PropertyRef("Uid")
|
|
26
|
+
root_directory_path: PropertyRef = PropertyRef("RootDirectoryPath")
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class EfsAccessPointToAwsAccountRelProperties(CartographyRelProperties):
|
|
32
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
class EfsAccessPointToAWSAccountRel(CartographyRelSchema):
|
|
37
|
+
target_node_label: str = "AWSAccount"
|
|
38
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
39
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
40
|
+
)
|
|
41
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
42
|
+
rel_label: str = "RESOURCE"
|
|
43
|
+
properties: EfsAccessPointToAwsAccountRelProperties = (
|
|
44
|
+
EfsAccessPointToAwsAccountRelProperties()
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True)
|
|
49
|
+
class EfsAccessPointToEfsFileSystemRelProperties(CartographyRelProperties):
|
|
50
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class EfsAccessPointToEfsFileSystemRel(CartographyRelSchema):
|
|
55
|
+
target_node_label: str = "EfsFileSystem"
|
|
56
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
57
|
+
{"id": PropertyRef("FileSystemId")},
|
|
58
|
+
)
|
|
59
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
60
|
+
rel_label: str = "ACCESS_POINT_OF"
|
|
61
|
+
properties: EfsAccessPointToEfsFileSystemRelProperties = (
|
|
62
|
+
EfsAccessPointToEfsFileSystemRelProperties()
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass(frozen=True)
|
|
67
|
+
class EfsAccessPointSchema(CartographyNodeSchema):
|
|
68
|
+
label: str = "EfsAccessPoint"
|
|
69
|
+
properties: EfsAccessPointNodeProperties = EfsAccessPointNodeProperties()
|
|
70
|
+
sub_resource_relationship: EfsAccessPointToAWSAccountRel = (
|
|
71
|
+
EfsAccessPointToAWSAccountRel()
|
|
72
|
+
)
|
|
73
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
74
|
+
[
|
|
75
|
+
EfsAccessPointToEfsFileSystemRel(),
|
|
76
|
+
]
|
|
77
|
+
)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class EfsFileSystemNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("FileSystemId")
|
|
16
|
+
arn: PropertyRef = PropertyRef("FileSystemArn", extra_index=True)
|
|
17
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
18
|
+
owner_id: PropertyRef = PropertyRef("OwnerId")
|
|
19
|
+
creation_token: PropertyRef = PropertyRef("CreationToken")
|
|
20
|
+
creation_time: PropertyRef = PropertyRef("CreationTime")
|
|
21
|
+
lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
|
|
22
|
+
name: PropertyRef = PropertyRef("Name")
|
|
23
|
+
number_of_mount_targets: PropertyRef = PropertyRef("NumberOfMountTargets")
|
|
24
|
+
size_in_bytes_value: PropertyRef = PropertyRef("SizeInBytesValue")
|
|
25
|
+
size_in_bytes_timestamp: PropertyRef = PropertyRef("SizeInBytesTimestamp")
|
|
26
|
+
performance_mode: PropertyRef = PropertyRef("PerformanceMode")
|
|
27
|
+
encrypted: PropertyRef = PropertyRef("Encrypted")
|
|
28
|
+
kms_key_id: PropertyRef = PropertyRef("KmsKeyId")
|
|
29
|
+
throughput_mode: PropertyRef = PropertyRef("ThroughputMode")
|
|
30
|
+
availability_zone_name: PropertyRef = PropertyRef("AvailabilityZoneName")
|
|
31
|
+
availability_zone_id: PropertyRef = PropertyRef("AvailabilityZoneId")
|
|
32
|
+
file_system_protection: PropertyRef = PropertyRef("FileSystemProtection")
|
|
33
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
class EfsFileSystemToAwsAccountRelProperties(CartographyRelProperties):
|
|
38
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class EfsFileSystemToAWSAccountRel(CartographyRelSchema):
|
|
43
|
+
target_node_label: str = "AWSAccount"
|
|
44
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
45
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
46
|
+
)
|
|
47
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
48
|
+
rel_label: str = "RESOURCE"
|
|
49
|
+
properties: EfsFileSystemToAwsAccountRelProperties = (
|
|
50
|
+
EfsFileSystemToAwsAccountRelProperties()
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True)
|
|
55
|
+
class EfsFileSystemSchema(CartographyNodeSchema):
|
|
56
|
+
label: str = "EfsFileSystem"
|
|
57
|
+
properties: EfsFileSystemNodeProperties = EfsFileSystemNodeProperties()
|
|
58
|
+
sub_resource_relationship: EfsFileSystemToAWSAccountRel = (
|
|
59
|
+
EfsFileSystemToAWSAccountRel()
|
|
60
|
+
)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class EfsMountTargetNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("MountTargetId")
|
|
17
|
+
arn: PropertyRef = PropertyRef("MountTargetId", extra_index=True)
|
|
18
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
19
|
+
fileSystem_id: PropertyRef = PropertyRef("FileSystemId")
|
|
20
|
+
lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
|
|
21
|
+
mount_target_id: PropertyRef = PropertyRef("MountTargetId")
|
|
22
|
+
subnet_id: PropertyRef = PropertyRef("SubnetId")
|
|
23
|
+
availability_zone_id: PropertyRef = PropertyRef("AvailabilityZoneId")
|
|
24
|
+
availability_zone_name: PropertyRef = PropertyRef("AvailabilityZoneName")
|
|
25
|
+
ip_address: PropertyRef = PropertyRef("IpAddress")
|
|
26
|
+
network_interface_id: PropertyRef = PropertyRef("NetworkInterfaceId")
|
|
27
|
+
owner_id: PropertyRef = PropertyRef("OwnerId")
|
|
28
|
+
vpc_id: PropertyRef = PropertyRef("VpcId")
|
|
29
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
class EfsMountTargetToAwsAccountRelProperties(CartographyRelProperties):
|
|
34
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True)
|
|
38
|
+
class EfsMountTargetToAWSAccountRel(CartographyRelSchema):
|
|
39
|
+
target_node_label: str = "AWSAccount"
|
|
40
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
41
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
42
|
+
)
|
|
43
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
44
|
+
rel_label: str = "RESOURCE"
|
|
45
|
+
properties: EfsMountTargetToAwsAccountRelProperties = (
|
|
46
|
+
EfsMountTargetToAwsAccountRelProperties()
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class EfsMountTargetToEfsFileSystemRelProperties(CartographyRelProperties):
|
|
52
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class EfsMountTargetToEfsFileSystemRel(CartographyRelSchema):
|
|
57
|
+
target_node_label: str = "EfsFileSystem"
|
|
58
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
59
|
+
{"id": PropertyRef("FileSystemId")},
|
|
60
|
+
)
|
|
61
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
62
|
+
rel_label: str = "ATTACHED_TO"
|
|
63
|
+
properties: EfsMountTargetToEfsFileSystemRelProperties = (
|
|
64
|
+
EfsMountTargetToEfsFileSystemRelProperties()
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass(frozen=True)
|
|
69
|
+
class EfsMountTargetSchema(CartographyNodeSchema):
|
|
70
|
+
label: str = "EfsMountTarget"
|
|
71
|
+
properties: EfsMountTargetNodeProperties = EfsMountTargetNodeProperties()
|
|
72
|
+
sub_resource_relationship: EfsMountTargetToAWSAccountRel = (
|
|
73
|
+
EfsMountTargetToAWSAccountRel()
|
|
74
|
+
)
|
|
75
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
76
|
+
[
|
|
77
|
+
EfsMountTargetToEfsFileSystemRel(),
|
|
78
|
+
]
|
|
79
|
+
)
|
|
@@ -63,6 +63,7 @@ class PropertyRef:
|
|
|
63
63
|
```
|
|
64
64
|
This means that as we create AWSInstanceProfile nodes, we will search for AWSRoles to attach to, and we do
|
|
65
65
|
this by checking if each role's `arn` field is in the `Roles` list of the data dict.
|
|
66
|
+
Note that one_to_many has no effect on matchlinks.
|
|
66
67
|
"""
|
|
67
68
|
self.name = name
|
|
68
69
|
self.set_in_kwargs = set_in_kwargs
|
|
@@ -42,6 +42,11 @@ class CartographyRelProperties(abc.ABC):
|
|
|
42
42
|
Abstract class that represents the properties on a CartographyRelSchema. This is intended to enforce that all
|
|
43
43
|
subclasses will have a lastupdated field defined on their resulting relationships. These fields are assigned to the
|
|
44
44
|
relationship in the `SET` clause.
|
|
45
|
+
|
|
46
|
+
If the CartographyRelSchema is used as a MatchLink, the following properties are required to be defined here:
|
|
47
|
+
- lastupdated: A PropertyRef to the update tag of the relationship.
|
|
48
|
+
- _sub_resource_label: A PropertyRef to the label of the sub-resource that the relationship is associated with.
|
|
49
|
+
- _sub_resource_id: A PropertyRef to the id of the sub-resource that the relationship is associated with.
|
|
45
50
|
"""
|
|
46
51
|
|
|
47
52
|
lastupdated: PropertyRef = field(init=False)
|
|
@@ -90,6 +95,29 @@ def make_target_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> TargetNode
|
|
|
90
95
|
return make_dataclass(TargetNodeMatcher.__name__, fields, frozen=True)()
|
|
91
96
|
|
|
92
97
|
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class SourceNodeMatcher:
|
|
100
|
+
"""
|
|
101
|
+
Same as TargetNodeMatcher, but for the source node; see `make_source_node_matcher()`.
|
|
102
|
+
This object is used only for load_matchlinks() where we match on and connect existing nodes.
|
|
103
|
+
This has no effect on CartographyRelSchema objects that are included in CartographyNodeSchema.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def make_source_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> SourceNodeMatcher:
|
|
110
|
+
"""
|
|
111
|
+
:param key_ref_dict: A Dict mapping keys present on the node to PropertyRef objects.
|
|
112
|
+
:return: A SourceNodeMatcher used for CartographyRelSchema to match with other nodes.
|
|
113
|
+
"""
|
|
114
|
+
fields = [
|
|
115
|
+
(key, PropertyRef, field(default=prop_ref))
|
|
116
|
+
for key, prop_ref in key_ref_dict.items()
|
|
117
|
+
]
|
|
118
|
+
return make_dataclass(SourceNodeMatcher.__name__, fields, frozen=True)()
|
|
119
|
+
|
|
120
|
+
|
|
93
121
|
@dataclass(frozen=True)
|
|
94
122
|
class CartographyRelSchema(abc.ABC):
|
|
95
123
|
"""
|
|
@@ -139,6 +167,22 @@ class CartographyRelSchema(abc.ABC):
|
|
|
139
167
|
"""
|
|
140
168
|
pass
|
|
141
169
|
|
|
170
|
+
@property
|
|
171
|
+
def source_node_label(self) -> str | None:
|
|
172
|
+
"""
|
|
173
|
+
:return: Optional. Only used for load_matchlinks(). The source node label to use for the relationship.
|
|
174
|
+
This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
|
|
175
|
+
"""
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def source_node_matcher(self) -> SourceNodeMatcher | None:
|
|
180
|
+
"""
|
|
181
|
+
:return: Optional. Only used for load_matchlinks(). A SourceNodeMatcher object used to find what node(s) to attach the relationship to.
|
|
182
|
+
This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
|
|
183
|
+
"""
|
|
184
|
+
return None
|
|
185
|
+
|
|
142
186
|
|
|
143
187
|
@dataclass(frozen=True)
|
|
144
188
|
class OtherRelationships:
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class EntraAppRoleAssignmentNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
app_role_id: PropertyRef = PropertyRef("app_role_id")
|
|
18
|
+
created_date_time: PropertyRef = PropertyRef("created_date_time")
|
|
19
|
+
principal_id: PropertyRef = PropertyRef("principal_id")
|
|
20
|
+
principal_display_name: PropertyRef = PropertyRef("principal_display_name")
|
|
21
|
+
principal_type: PropertyRef = PropertyRef("principal_type")
|
|
22
|
+
resource_display_name: PropertyRef = PropertyRef("resource_display_name")
|
|
23
|
+
resource_id: PropertyRef = PropertyRef("resource_id")
|
|
24
|
+
application_app_id: PropertyRef = PropertyRef("application_app_id")
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class EntraAppRoleAssignmentToTenantRelProperties(CartographyRelProperties):
|
|
30
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class EntraAppRoleAssignmentToTenantRel(CartographyRelSchema):
|
|
35
|
+
target_node_label: str = "EntraTenant"
|
|
36
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
38
|
+
)
|
|
39
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
40
|
+
rel_label: str = "RESOURCE"
|
|
41
|
+
properties: EntraAppRoleAssignmentToTenantRelProperties = (
|
|
42
|
+
EntraAppRoleAssignmentToTenantRelProperties()
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class EntraAppRoleAssignmentToApplicationRelProperties(CartographyRelProperties):
|
|
48
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(frozen=True)
|
|
52
|
+
class EntraAppRoleAssignmentToApplicationRel(CartographyRelSchema):
|
|
53
|
+
target_node_label: str = "EntraApplication"
|
|
54
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
55
|
+
{"app_id": PropertyRef("application_app_id")},
|
|
56
|
+
)
|
|
57
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
58
|
+
rel_label: str = "ASSIGNED_TO"
|
|
59
|
+
properties: EntraAppRoleAssignmentToApplicationRelProperties = (
|
|
60
|
+
EntraAppRoleAssignmentToApplicationRelProperties()
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class EntraAppRoleAssignmentToUserRelProperties(CartographyRelProperties):
|
|
66
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class EntraAppRoleAssignmentToUserRel(CartographyRelSchema):
|
|
71
|
+
target_node_label: str = "EntraUser"
|
|
72
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
73
|
+
{"id": PropertyRef("principal_id")},
|
|
74
|
+
)
|
|
75
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
76
|
+
rel_label: str = "HAS_APP_ROLE"
|
|
77
|
+
properties: EntraAppRoleAssignmentToUserRelProperties = (
|
|
78
|
+
EntraAppRoleAssignmentToUserRelProperties()
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass(frozen=True)
|
|
83
|
+
class EntraAppRoleAssignmentToGroupRelProperties(CartographyRelProperties):
|
|
84
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(frozen=True)
|
|
88
|
+
class EntraAppRoleAssignmentToGroupRel(CartographyRelSchema):
|
|
89
|
+
target_node_label: str = "EntraGroup"
|
|
90
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
91
|
+
{"id": PropertyRef("principal_id")},
|
|
92
|
+
)
|
|
93
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
94
|
+
rel_label: str = "HAS_APP_ROLE"
|
|
95
|
+
properties: EntraAppRoleAssignmentToGroupRelProperties = (
|
|
96
|
+
EntraAppRoleAssignmentToGroupRelProperties()
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(frozen=True)
|
|
101
|
+
class EntraAppRoleAssignmentSchema(CartographyNodeSchema):
|
|
102
|
+
label: str = "EntraAppRoleAssignment"
|
|
103
|
+
properties: EntraAppRoleAssignmentNodeProperties = (
|
|
104
|
+
EntraAppRoleAssignmentNodeProperties()
|
|
105
|
+
)
|
|
106
|
+
sub_resource_relationship: EntraAppRoleAssignmentToTenantRel = (
|
|
107
|
+
EntraAppRoleAssignmentToTenantRel()
|
|
108
|
+
)
|
|
109
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
110
|
+
[
|
|
111
|
+
EntraAppRoleAssignmentToApplicationRel(),
|
|
112
|
+
EntraAppRoleAssignmentToUserRel(),
|
|
113
|
+
EntraAppRoleAssignmentToGroupRel(),
|
|
114
|
+
],
|
|
115
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class EntraApplicationNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
app_id: PropertyRef = PropertyRef("app_id")
|
|
17
|
+
display_name: PropertyRef = PropertyRef("display_name")
|
|
18
|
+
publisher_domain: PropertyRef = PropertyRef("publisher_domain")
|
|
19
|
+
sign_in_audience: PropertyRef = PropertyRef("sign_in_audience")
|
|
20
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class EntraApplicationToTenantRelProperties(CartographyRelProperties):
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class EntraApplicationToTenantRel(CartographyRelSchema):
|
|
30
|
+
target_node_label: str = "EntraTenant"
|
|
31
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
33
|
+
)
|
|
34
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
35
|
+
rel_label: str = "RESOURCE"
|
|
36
|
+
properties: EntraApplicationToTenantRelProperties = (
|
|
37
|
+
EntraApplicationToTenantRelProperties()
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class EntraApplicationSchema(CartographyNodeSchema):
|
|
43
|
+
label: str = "EntraApplication"
|
|
44
|
+
properties: EntraApplicationNodeProperties = EntraApplicationNodeProperties()
|
|
45
|
+
sub_resource_relationship: EntraApplicationToTenantRel = (
|
|
46
|
+
EntraApplicationToTenantRel()
|
|
47
|
+
)
|
|
File without changes
|