cartography 0.105.0__py3-none-any.whl → 0.106.0__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 (108) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +78 -2
  3. cartography/client/core/tx.py +62 -0
  4. cartography/config.py +24 -0
  5. cartography/data/indexes.cypher +0 -34
  6. cartography/driftdetect/cli.py +3 -2
  7. cartography/graph/cleanupbuilder.py +47 -0
  8. cartography/graph/job.py +42 -0
  9. cartography/graph/querybuilder.py +136 -2
  10. cartography/graph/statement.py +1 -1
  11. cartography/intel/airbyte/__init__.py +105 -0
  12. cartography/intel/airbyte/connections.py +120 -0
  13. cartography/intel/airbyte/destinations.py +81 -0
  14. cartography/intel/airbyte/organizations.py +59 -0
  15. cartography/intel/airbyte/sources.py +78 -0
  16. cartography/intel/airbyte/tags.py +64 -0
  17. cartography/intel/airbyte/users.py +106 -0
  18. cartography/intel/airbyte/util.py +122 -0
  19. cartography/intel/airbyte/workspaces.py +63 -0
  20. cartography/intel/aws/codebuild.py +132 -0
  21. cartography/intel/aws/ecs.py +228 -380
  22. cartography/intel/aws/efs.py +261 -0
  23. cartography/intel/aws/identitycenter.py +14 -3
  24. cartography/intel/aws/inspector.py +96 -53
  25. cartography/intel/aws/rds.py +2 -1
  26. cartography/intel/aws/resources.py +4 -0
  27. cartography/intel/entra/__init__.py +11 -0
  28. cartography/intel/entra/applications.py +366 -0
  29. cartography/intel/entra/users.py +84 -42
  30. cartography/intel/kubernetes/__init__.py +30 -14
  31. cartography/intel/kubernetes/clusters.py +86 -0
  32. cartography/intel/kubernetes/namespaces.py +59 -57
  33. cartography/intel/kubernetes/pods.py +140 -77
  34. cartography/intel/kubernetes/secrets.py +95 -45
  35. cartography/intel/kubernetes/services.py +131 -67
  36. cartography/intel/kubernetes/util.py +125 -14
  37. cartography/intel/scaleway/__init__.py +127 -0
  38. cartography/intel/scaleway/iam/__init__.py +0 -0
  39. cartography/intel/scaleway/iam/apikeys.py +71 -0
  40. cartography/intel/scaleway/iam/applications.py +71 -0
  41. cartography/intel/scaleway/iam/groups.py +71 -0
  42. cartography/intel/scaleway/iam/users.py +71 -0
  43. cartography/intel/scaleway/instances/__init__.py +0 -0
  44. cartography/intel/scaleway/instances/flexibleips.py +86 -0
  45. cartography/intel/scaleway/instances/instances.py +92 -0
  46. cartography/intel/scaleway/projects.py +79 -0
  47. cartography/intel/scaleway/storage/__init__.py +0 -0
  48. cartography/intel/scaleway/storage/snapshots.py +86 -0
  49. cartography/intel/scaleway/storage/volumes.py +84 -0
  50. cartography/intel/scaleway/utils.py +37 -0
  51. cartography/models/airbyte/__init__.py +0 -0
  52. cartography/models/airbyte/connection.py +138 -0
  53. cartography/models/airbyte/destination.py +75 -0
  54. cartography/models/airbyte/organization.py +19 -0
  55. cartography/models/airbyte/source.py +75 -0
  56. cartography/models/airbyte/stream.py +74 -0
  57. cartography/models/airbyte/tag.py +69 -0
  58. cartography/models/airbyte/user.py +111 -0
  59. cartography/models/airbyte/workspace.py +46 -0
  60. cartography/models/aws/codebuild/__init__.py +0 -0
  61. cartography/models/aws/codebuild/project.py +49 -0
  62. cartography/models/aws/ecs/__init__.py +0 -0
  63. cartography/models/aws/ecs/clusters.py +64 -0
  64. cartography/models/aws/ecs/container_definitions.py +93 -0
  65. cartography/models/aws/ecs/container_instances.py +84 -0
  66. cartography/models/aws/ecs/containers.py +99 -0
  67. cartography/models/aws/ecs/services.py +117 -0
  68. cartography/models/aws/ecs/task_definitions.py +135 -0
  69. cartography/models/aws/ecs/tasks.py +110 -0
  70. cartography/models/aws/efs/__init__.py +0 -0
  71. cartography/models/aws/efs/access_point.py +77 -0
  72. cartography/models/aws/efs/file_system.py +60 -0
  73. cartography/models/aws/efs/mount_target.py +79 -0
  74. cartography/models/core/common.py +1 -0
  75. cartography/models/core/relationships.py +44 -0
  76. cartography/models/entra/app_role_assignment.py +115 -0
  77. cartography/models/entra/application.py +47 -0
  78. cartography/models/entra/user.py +17 -51
  79. cartography/models/kubernetes/__init__.py +0 -0
  80. cartography/models/kubernetes/clusters.py +26 -0
  81. cartography/models/kubernetes/containers.py +108 -0
  82. cartography/models/kubernetes/namespaces.py +51 -0
  83. cartography/models/kubernetes/pods.py +80 -0
  84. cartography/models/kubernetes/secrets.py +79 -0
  85. cartography/models/kubernetes/services.py +108 -0
  86. cartography/models/scaleway/__init__.py +0 -0
  87. cartography/models/scaleway/iam/__init__.py +0 -0
  88. cartography/models/scaleway/iam/apikey.py +96 -0
  89. cartography/models/scaleway/iam/application.py +52 -0
  90. cartography/models/scaleway/iam/group.py +95 -0
  91. cartography/models/scaleway/iam/user.py +60 -0
  92. cartography/models/scaleway/instance/__init__.py +0 -0
  93. cartography/models/scaleway/instance/flexibleip.py +52 -0
  94. cartography/models/scaleway/instance/instance.py +118 -0
  95. cartography/models/scaleway/organization.py +19 -0
  96. cartography/models/scaleway/project.py +48 -0
  97. cartography/models/scaleway/storage/__init__.py +0 -0
  98. cartography/models/scaleway/storage/snapshot.py +78 -0
  99. cartography/models/scaleway/storage/volume.py +51 -0
  100. cartography/sync.py +8 -4
  101. cartography/util.py +15 -10
  102. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/METADATA +5 -2
  103. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/RECORD +107 -35
  104. cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
  105. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/WHEEL +0 -0
  106. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/entry_points.txt +0 -0
  107. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/licenses/LICENSE +0 -0
  108. {cartography-0.105.0.dist-info → cartography-0.106.0.dist-info}/top_level.txt +0 -0
@@ -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
+ )
@@ -9,6 +9,10 @@ from cartography.models.core.relationships import LinkDirection
9
9
  from cartography.models.core.relationships import make_target_node_matcher
10
10
  from cartography.models.core.relationships import TargetNodeMatcher
11
11
 
12
+ # The user resource in Microsoft Graph exposes hundreds of properties but, in
13
+ # practice, only a small subset is populated in most tenants. We deliberately
14
+ # model *just* the commonly-used attributes to keep the graph lean.
15
+
12
16
 
13
17
  @dataclass(frozen=True)
14
18
  class EntraUserNodeProperties(CartographyNodeProperties):
@@ -17,61 +21,23 @@ class EntraUserNodeProperties(CartographyNodeProperties):
17
21
  display_name: PropertyRef = PropertyRef("display_name")
18
22
  given_name: PropertyRef = PropertyRef("given_name")
19
23
  surname: PropertyRef = PropertyRef("surname")
20
- # The underlying datatype calls this 'mail' but everything else in cartography uses 'email'
24
+ # The SDK calls this `mail`; we surface it as `email` like the rest of Cartography
21
25
  email: PropertyRef = PropertyRef("mail", extra_index=True)
22
- other_mails: PropertyRef = PropertyRef("other_mails")
23
- preferred_language: PropertyRef = PropertyRef("preferred_language")
24
- preferred_name: PropertyRef = PropertyRef("preferred_name")
25
- state: PropertyRef = PropertyRef("state")
26
- usage_location: PropertyRef = PropertyRef("usage_location")
27
- user_type: PropertyRef = PropertyRef("user_type")
28
- show_in_address_list: PropertyRef = PropertyRef("show_in_address_list")
29
- sign_in_sessions_valid_from_date_time: PropertyRef = PropertyRef(
30
- "sign_in_sessions_valid_from_date_time"
31
- )
32
- security_identifier: PropertyRef = PropertyRef("security_identifier")
33
- account_enabled: PropertyRef = PropertyRef("account_enabled")
34
- city: PropertyRef = PropertyRef("city")
35
- company_name: PropertyRef = PropertyRef("company_name")
36
- consent_provided_for_minor: PropertyRef = PropertyRef("consent_provided_for_minor")
37
- country: PropertyRef = PropertyRef("country")
38
- created_date_time: PropertyRef = PropertyRef("created_date_time")
39
- creation_type: PropertyRef = PropertyRef("creation_type")
40
- deleted_date_time: PropertyRef = PropertyRef("deleted_date_time")
26
+ mobile_phone: PropertyRef = PropertyRef("mobile_phone")
27
+ business_phones: PropertyRef = PropertyRef("business_phones")
28
+ job_title: PropertyRef = PropertyRef("job_title")
41
29
  department: PropertyRef = PropertyRef("department")
30
+ company_name: PropertyRef = PropertyRef("company_name")
31
+ office_location: PropertyRef = PropertyRef("office_location")
42
32
  employee_id: PropertyRef = PropertyRef("employee_id")
43
33
  employee_type: PropertyRef = PropertyRef("employee_type")
44
- external_user_state: PropertyRef = PropertyRef("external_user_state")
45
- external_user_state_change_date_time: PropertyRef = PropertyRef(
46
- "external_user_state_change_date_time"
47
- )
48
- hire_date: PropertyRef = PropertyRef("hire_date")
49
- is_management_restricted: PropertyRef = PropertyRef("is_management_restricted")
50
- is_resource_account: PropertyRef = PropertyRef("is_resource_account")
51
- job_title: PropertyRef = PropertyRef("job_title")
52
- last_password_change_date_time: PropertyRef = PropertyRef(
53
- "last_password_change_date_time"
54
- )
55
- mail_nickname: PropertyRef = PropertyRef("mail_nickname")
56
- office_location: PropertyRef = PropertyRef("office_location")
57
- on_premises_distinguished_name: PropertyRef = PropertyRef(
58
- "on_premises_distinguished_name"
59
- )
60
- on_premises_domain_name: PropertyRef = PropertyRef("on_premises_domain_name")
61
- on_premises_immutable_id: PropertyRef = PropertyRef("on_premises_immutable_id")
62
- on_premises_last_sync_date_time: PropertyRef = PropertyRef(
63
- "on_premises_last_sync_date_time"
64
- )
65
- on_premises_sam_account_name: PropertyRef = PropertyRef(
66
- "on_premises_sam_account_name"
67
- )
68
- on_premises_security_identifier: PropertyRef = PropertyRef(
69
- "on_premises_security_identifier"
70
- )
71
- on_premises_sync_enabled: PropertyRef = PropertyRef("on_premises_sync_enabled")
72
- on_premises_user_principal_name: PropertyRef = PropertyRef(
73
- "on_premises_user_principal_name"
74
- )
34
+ city: PropertyRef = PropertyRef("city")
35
+ state: PropertyRef = PropertyRef("state")
36
+ country: PropertyRef = PropertyRef("country")
37
+ preferred_language: PropertyRef = PropertyRef("preferred_language")
38
+ account_enabled: PropertyRef = PropertyRef("account_enabled")
39
+ age_group: PropertyRef = PropertyRef("age_group")
40
+ manager_id: PropertyRef = PropertyRef("manager_id")
75
41
  lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
76
42
 
77
43
 
File without changes