cartography 0.105.0__py3-none-any.whl → 0.106.0rc1__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.

Files changed (45) hide show
  1. cartography/_version.py +2 -2
  2. cartography/data/indexes.cypher +0 -34
  3. cartography/intel/aws/ecs.py +228 -380
  4. cartography/intel/aws/efs.py +181 -0
  5. cartography/intel/aws/identitycenter.py +14 -3
  6. cartography/intel/aws/inspector.py +106 -53
  7. cartography/intel/aws/rds.py +2 -1
  8. cartography/intel/aws/resources.py +2 -0
  9. cartography/intel/entra/__init__.py +11 -0
  10. cartography/intel/entra/applications.py +366 -0
  11. cartography/intel/kubernetes/__init__.py +30 -14
  12. cartography/intel/kubernetes/clusters.py +86 -0
  13. cartography/intel/kubernetes/namespaces.py +59 -57
  14. cartography/intel/kubernetes/pods.py +140 -77
  15. cartography/intel/kubernetes/secrets.py +95 -45
  16. cartography/intel/kubernetes/services.py +131 -67
  17. cartography/intel/kubernetes/util.py +125 -14
  18. cartography/models/aws/ecs/__init__.py +0 -0
  19. cartography/models/aws/ecs/clusters.py +64 -0
  20. cartography/models/aws/ecs/container_definitions.py +93 -0
  21. cartography/models/aws/ecs/container_instances.py +84 -0
  22. cartography/models/aws/ecs/containers.py +80 -0
  23. cartography/models/aws/ecs/services.py +117 -0
  24. cartography/models/aws/ecs/task_definitions.py +97 -0
  25. cartography/models/aws/ecs/tasks.py +110 -0
  26. cartography/models/aws/efs/__init__.py +0 -0
  27. cartography/models/aws/efs/file_system.py +60 -0
  28. cartography/models/aws/efs/mount_target.py +79 -0
  29. cartography/models/entra/app_role_assignment.py +115 -0
  30. cartography/models/entra/application.py +47 -0
  31. cartography/models/kubernetes/__init__.py +0 -0
  32. cartography/models/kubernetes/clusters.py +26 -0
  33. cartography/models/kubernetes/containers.py +108 -0
  34. cartography/models/kubernetes/namespaces.py +51 -0
  35. cartography/models/kubernetes/pods.py +80 -0
  36. cartography/models/kubernetes/secrets.py +79 -0
  37. cartography/models/kubernetes/services.py +108 -0
  38. cartography/util.py +15 -10
  39. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.dist-info}/METADATA +1 -1
  40. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.dist-info}/RECORD +44 -22
  41. cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
  42. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.dist-info}/WHEEL +0 -0
  43. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.dist-info}/entry_points.txt +0 -0
  44. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.dist-info}/licenses/LICENSE +0 -0
  45. {cartography-0.105.0.dist-info → cartography-0.106.0rc1.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,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
+ )
@@ -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
@@ -0,0 +1,26 @@
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
+
7
+
8
+ @dataclass(frozen=True)
9
+ class KubernetesClusterNodeProperties(CartographyNodeProperties):
10
+ id: PropertyRef = PropertyRef("id")
11
+ name: PropertyRef = PropertyRef("name", extra_index=True)
12
+ creation_timestamp: PropertyRef = PropertyRef("creation_timestamp")
13
+ external_id: PropertyRef = PropertyRef("external_id", extra_index=True)
14
+ version: PropertyRef = PropertyRef("git_version")
15
+ version_major: PropertyRef = PropertyRef("version_major")
16
+ version_minor: PropertyRef = PropertyRef("version_minor")
17
+ go_version: PropertyRef = PropertyRef("go_version")
18
+ compiler: PropertyRef = PropertyRef("compiler")
19
+ platform: PropertyRef = PropertyRef("platform")
20
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class KubernetesClusterSchema(CartographyNodeSchema):
25
+ label: str = "KubernetesCluster"
26
+ properties: KubernetesClusterNodeProperties = KubernetesClusterNodeProperties()
@@ -0,0 +1,108 @@
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 KubernetesContainerNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("uid")
17
+ name: PropertyRef = PropertyRef("name", extra_index=True)
18
+ image: PropertyRef = PropertyRef("image", extra_index=True)
19
+ namespace: PropertyRef = PropertyRef("namespace", extra_index=True)
20
+ cluster_name: PropertyRef = PropertyRef(
21
+ "CLUSTER_NAME", set_in_kwargs=True, extra_index=True
22
+ )
23
+ image_pull_policy: PropertyRef = PropertyRef("image_pull_policy")
24
+ status_image_id: PropertyRef = PropertyRef("status_image_id")
25
+ status_image_sha: PropertyRef = PropertyRef("status_image_sha")
26
+ status_ready: PropertyRef = PropertyRef("status_ready")
27
+ status_started: PropertyRef = PropertyRef("status_started")
28
+ status_state: PropertyRef = PropertyRef("status_state")
29
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class KubernetesContainerToKubernetesNamespaceRelProperties(CartographyRelProperties):
34
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ class KubernetesContainerToKubernetesPodRelProperties(CartographyRelProperties):
39
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ # (:KubernetesContainer)<-[:CONTAINS]-(:KubernetesNamespace)
44
+ class KubernetesContainerToKubernetesNamespaceRel(CartographyRelSchema):
45
+ target_node_label: str = "KubernetesNamespace"
46
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
47
+ {
48
+ "cluster_name": PropertyRef("CLUSTER_NAME", set_in_kwargs=True),
49
+ "name": PropertyRef("namespace"),
50
+ }
51
+ )
52
+ direction: LinkDirection = LinkDirection.INWARD
53
+ rel_label: str = "CONTAINS"
54
+ properties: KubernetesContainerToKubernetesNamespaceRelProperties = (
55
+ KubernetesContainerToKubernetesNamespaceRelProperties()
56
+ )
57
+
58
+
59
+ @dataclass(frozen=True)
60
+ # (:KubernetesContainer)<-[:CONTAINS]-(:KubernetesPod)
61
+ class KubernetesContainerToKubernetesPodRel(CartographyRelSchema):
62
+ target_node_label: str = "KubernetesPod"
63
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
64
+ {
65
+ "cluster_name": PropertyRef("CLUSTER_NAME", set_in_kwargs=True),
66
+ "namespace": PropertyRef("namespace"),
67
+ "id": PropertyRef("pod_id"),
68
+ }
69
+ )
70
+ direction: LinkDirection = LinkDirection.INWARD
71
+ rel_label: str = "CONTAINS"
72
+ properties: KubernetesContainerToKubernetesPodRelProperties = (
73
+ KubernetesContainerToKubernetesPodRelProperties()
74
+ )
75
+
76
+
77
+ @dataclass(frozen=True)
78
+ class KubernetesContainerToKubernetesClusterRelProperties(CartographyRelProperties):
79
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
80
+
81
+
82
+ @dataclass(frozen=True)
83
+ # (:KubernetesContainer)<-[:RESOURCE]-(:KubernetesCluster)
84
+ class KubernetesContainerToKubernetesClusterRel(CartographyRelSchema):
85
+ target_node_label: str = "KubernetesCluster"
86
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
87
+ {"id": PropertyRef("CLUSTER_ID", set_in_kwargs=True)}
88
+ )
89
+ direction: LinkDirection = LinkDirection.INWARD
90
+ rel_label: str = "RESOURCE"
91
+ properties: KubernetesContainerToKubernetesClusterRelProperties = (
92
+ KubernetesContainerToKubernetesClusterRelProperties()
93
+ )
94
+
95
+
96
+ @dataclass(frozen=True)
97
+ class KubernetesContainerSchema(CartographyNodeSchema):
98
+ label: str = "KubernetesContainer"
99
+ properties: KubernetesContainerNodeProperties = KubernetesContainerNodeProperties()
100
+ sub_resource_relationship: KubernetesContainerToKubernetesClusterRel = (
101
+ KubernetesContainerToKubernetesClusterRel()
102
+ )
103
+ other_relationships: OtherRelationships = OtherRelationships(
104
+ [
105
+ KubernetesContainerToKubernetesNamespaceRel(),
106
+ KubernetesContainerToKubernetesPodRel(),
107
+ ]
108
+ )