cartography 0.104.0rc3__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 (75) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +26 -1
  3. cartography/client/aws/__init__.py +19 -0
  4. cartography/client/aws/ecr.py +51 -0
  5. cartography/config.py +8 -0
  6. cartography/data/indexes.cypher +0 -37
  7. cartography/data/jobs/cleanup/aws_import_lambda_cleanup.json +1 -1
  8. cartography/graph/cleanupbuilder.py +151 -41
  9. cartography/intel/aws/acm.py +124 -0
  10. cartography/intel/aws/cloudtrail.py +3 -38
  11. cartography/intel/aws/ecr.py +8 -2
  12. cartography/intel/aws/ecs.py +228 -380
  13. cartography/intel/aws/efs.py +99 -11
  14. cartography/intel/aws/iam.py +1 -1
  15. cartography/intel/aws/identitycenter.py +14 -3
  16. cartography/intel/aws/inspector.py +106 -53
  17. cartography/intel/aws/lambda_function.py +1 -1
  18. cartography/intel/aws/rds.py +2 -1
  19. cartography/intel/aws/resources.py +2 -0
  20. cartography/intel/aws/s3.py +195 -4
  21. cartography/intel/aws/sqs.py +36 -90
  22. cartography/intel/entra/__init__.py +22 -0
  23. cartography/intel/entra/applications.py +366 -0
  24. cartography/intel/entra/groups.py +151 -0
  25. cartography/intel/entra/ou.py +21 -5
  26. cartography/intel/kubernetes/__init__.py +30 -14
  27. cartography/intel/kubernetes/clusters.py +86 -0
  28. cartography/intel/kubernetes/namespaces.py +59 -57
  29. cartography/intel/kubernetes/pods.py +140 -77
  30. cartography/intel/kubernetes/secrets.py +95 -45
  31. cartography/intel/kubernetes/services.py +131 -67
  32. cartography/intel/kubernetes/util.py +125 -14
  33. cartography/intel/trivy/__init__.py +161 -0
  34. cartography/intel/trivy/scanner.py +363 -0
  35. cartography/models/aws/acm/__init__.py +0 -0
  36. cartography/models/aws/acm/certificate.py +75 -0
  37. cartography/models/aws/cloudtrail/trail.py +24 -0
  38. cartography/models/aws/ecs/__init__.py +0 -0
  39. cartography/models/aws/ecs/clusters.py +64 -0
  40. cartography/models/aws/ecs/container_definitions.py +93 -0
  41. cartography/models/aws/ecs/container_instances.py +84 -0
  42. cartography/models/aws/ecs/containers.py +80 -0
  43. cartography/models/aws/ecs/services.py +117 -0
  44. cartography/models/aws/ecs/task_definitions.py +97 -0
  45. cartography/models/aws/ecs/tasks.py +110 -0
  46. cartography/models/aws/efs/file_system.py +60 -0
  47. cartography/models/aws/efs/mount_target.py +29 -2
  48. cartography/models/aws/s3/notification.py +24 -0
  49. cartography/models/aws/secretsmanager/secret_version.py +0 -2
  50. cartography/models/aws/sqs/__init__.py +0 -0
  51. cartography/models/aws/sqs/queue.py +89 -0
  52. cartography/models/core/nodes.py +15 -2
  53. cartography/models/entra/app_role_assignment.py +115 -0
  54. cartography/models/entra/application.py +47 -0
  55. cartography/models/entra/group.py +91 -0
  56. cartography/models/kubernetes/__init__.py +0 -0
  57. cartography/models/kubernetes/clusters.py +26 -0
  58. cartography/models/kubernetes/containers.py +108 -0
  59. cartography/models/kubernetes/namespaces.py +51 -0
  60. cartography/models/kubernetes/pods.py +80 -0
  61. cartography/models/kubernetes/secrets.py +79 -0
  62. cartography/models/kubernetes/services.py +108 -0
  63. cartography/models/trivy/__init__.py +0 -0
  64. cartography/models/trivy/findings.py +66 -0
  65. cartography/models/trivy/fix.py +66 -0
  66. cartography/models/trivy/package.py +71 -0
  67. cartography/sync.py +2 -0
  68. cartography/util.py +15 -10
  69. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/METADATA +3 -2
  70. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/RECORD +74 -40
  71. cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
  72. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/WHEEL +0 -0
  73. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/entry_points.txt +0 -0
  74. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/licenses/LICENSE +0 -0
  75. {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,84 @@
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 ECSContainerInstanceNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("containerInstanceArn")
17
+ arn: PropertyRef = PropertyRef("containerInstanceArn", extra_index=True)
18
+ ec2_instance_id: PropertyRef = PropertyRef("ec2InstanceId")
19
+ capacity_provider_name: PropertyRef = PropertyRef("capacityProviderName")
20
+ version: PropertyRef = PropertyRef("version")
21
+ version_info_agent_version: PropertyRef = PropertyRef("versionInfo.agentVersion")
22
+ version_info_agent_hash: PropertyRef = PropertyRef("versionInfo.agentHash")
23
+ version_info_agent_docker_version: PropertyRef = PropertyRef(
24
+ "versionInfo.dockerVersion"
25
+ )
26
+ status: PropertyRef = PropertyRef("status")
27
+ status_reason: PropertyRef = PropertyRef("statusReason")
28
+ agent_connected: PropertyRef = PropertyRef("agentConnected")
29
+ agent_update_status: PropertyRef = PropertyRef("agentUpdateStatus")
30
+ registered_at: PropertyRef = PropertyRef("registeredAt")
31
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
32
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class ECSContainerInstanceToAWSAccountRelProperties(CartographyRelProperties):
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class ECSContainerInstanceToAWSAccountRel(CartographyRelSchema):
42
+ target_node_label: str = "AWSAccount"
43
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
44
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
45
+ )
46
+ direction: LinkDirection = LinkDirection.INWARD
47
+ rel_label: str = "RESOURCE"
48
+ properties: ECSContainerInstanceToAWSAccountRelProperties = (
49
+ ECSContainerInstanceToAWSAccountRelProperties()
50
+ )
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class ECSContainerInstanceToECSClusterRelProperties(CartographyRelProperties):
55
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class ECSContainerInstanceToECSClusterRel(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_CONTAINER_INSTANCE"
66
+ properties: ECSContainerInstanceToECSClusterRelProperties = (
67
+ ECSContainerInstanceToECSClusterRelProperties()
68
+ )
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class ECSContainerInstanceSchema(CartographyNodeSchema):
73
+ label: str = "ECSContainerInstance"
74
+ properties: ECSContainerInstanceNodeProperties = (
75
+ ECSContainerInstanceNodeProperties()
76
+ )
77
+ sub_resource_relationship: ECSContainerInstanceToAWSAccountRel = (
78
+ ECSContainerInstanceToAWSAccountRel()
79
+ )
80
+ other_relationships: OtherRelationships = OtherRelationships(
81
+ [
82
+ ECSContainerInstanceToECSClusterRel(),
83
+ ]
84
+ )
@@ -0,0 +1,80 @@
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 ECSContainerNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("containerArn")
17
+ arn: PropertyRef = PropertyRef("containerArn", extra_index=True)
18
+ task_arn: PropertyRef = PropertyRef("taskArn")
19
+ name: PropertyRef = PropertyRef("name")
20
+ image: PropertyRef = PropertyRef("image")
21
+ image_digest: PropertyRef = PropertyRef("imageDigest")
22
+ runtime_id: PropertyRef = PropertyRef("runtimeId")
23
+ last_status: PropertyRef = PropertyRef("lastStatus")
24
+ exit_code: PropertyRef = PropertyRef("exitCode")
25
+ reason: PropertyRef = PropertyRef("reason")
26
+ health_status: PropertyRef = PropertyRef("healthStatus")
27
+ cpu: PropertyRef = PropertyRef("cpu")
28
+ memory: PropertyRef = PropertyRef("memory")
29
+ memory_reservation: PropertyRef = PropertyRef("memoryReservation")
30
+ gpu_ids: PropertyRef = PropertyRef("gpuIds")
31
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
32
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class ECSContainerToAWSAccountRelProperties(CartographyRelProperties):
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class ECSContainerToAWSAccountRel(CartographyRelSchema):
42
+ target_node_label: str = "AWSAccount"
43
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
44
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
45
+ )
46
+ direction: LinkDirection = LinkDirection.INWARD
47
+ rel_label: str = "RESOURCE"
48
+ properties: ECSContainerToAWSAccountRelProperties = (
49
+ ECSContainerToAWSAccountRelProperties()
50
+ )
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class ECSContainerToTaskRelProperties(CartographyRelProperties):
55
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class ECSContainerToTaskRel(CartographyRelSchema):
60
+ target_node_label: str = "ECSTask"
61
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
62
+ {"id": PropertyRef("taskArn")}
63
+ )
64
+ direction: LinkDirection = LinkDirection.INWARD
65
+ rel_label: str = "HAS_CONTAINER"
66
+ properties: ECSContainerToTaskRelProperties = ECSContainerToTaskRelProperties()
67
+
68
+
69
+ @dataclass(frozen=True)
70
+ class ECSContainerSchema(CartographyNodeSchema):
71
+ label: str = "ECSContainer"
72
+ properties: ECSContainerNodeProperties = ECSContainerNodeProperties()
73
+ sub_resource_relationship: ECSContainerToAWSAccountRel = (
74
+ ECSContainerToAWSAccountRel()
75
+ )
76
+ other_relationships: OtherRelationships = OtherRelationships(
77
+ [
78
+ ECSContainerToTaskRel(),
79
+ ]
80
+ )
@@ -0,0 +1,117 @@
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 ECSServiceNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("serviceArn")
17
+ arn: PropertyRef = PropertyRef("serviceArn", extra_index=True)
18
+ name: PropertyRef = PropertyRef("serviceName")
19
+ cluster_arn: PropertyRef = PropertyRef("clusterArn")
20
+ status: PropertyRef = PropertyRef("status")
21
+ desired_count: PropertyRef = PropertyRef("desiredCount")
22
+ running_count: PropertyRef = PropertyRef("runningCount")
23
+ pending_count: PropertyRef = PropertyRef("pendingCount")
24
+ launch_type: PropertyRef = PropertyRef("launchType")
25
+ platform_version: PropertyRef = PropertyRef("platformVersion")
26
+ platform_family: PropertyRef = PropertyRef("platformFamily")
27
+ task_definition: PropertyRef = PropertyRef("taskDefinition")
28
+ deployment_config_circuit_breaker_enable: PropertyRef = PropertyRef(
29
+ "deploymentConfiguration.deploymentCircuitBreaker.enable"
30
+ )
31
+ deployment_config_circuit_breaker_rollback: PropertyRef = PropertyRef(
32
+ "deploymentConfiguration.deploymentCircuitBreaker.rollback"
33
+ )
34
+ deployment_config_maximum_percent: PropertyRef = PropertyRef(
35
+ "deploymentConfiguration.maximumPercent"
36
+ )
37
+ deployment_config_minimum_healthy_percent: PropertyRef = PropertyRef(
38
+ "deploymentConfiguration.minimumHealthyPercent"
39
+ )
40
+ role_arn: PropertyRef = PropertyRef("roleArn")
41
+ created_at: PropertyRef = PropertyRef("createdAt")
42
+ health_check_grace_period_seconds: PropertyRef = PropertyRef(
43
+ "healthCheckGracePeriodSeconds"
44
+ )
45
+ created_by: PropertyRef = PropertyRef("createdBy")
46
+ enable_ecs_managed_tags: PropertyRef = PropertyRef("enableECSManagedTags")
47
+ propagate_tags: PropertyRef = PropertyRef("propagateTags")
48
+ enable_execute_command: PropertyRef = PropertyRef("enableExecuteCommand")
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 ECSServiceToECSClusterRelProperties(CartographyRelProperties):
55
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class ECSServiceToECSClusterRel(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_SERVICE"
66
+ properties: ECSServiceToECSClusterRelProperties = (
67
+ ECSServiceToECSClusterRelProperties()
68
+ )
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class ECSServiceToTaskDefinitionRelProperties(CartographyRelProperties):
73
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
74
+
75
+
76
+ @dataclass(frozen=True)
77
+ class ECSServiceToTaskDefinitionRel(CartographyRelSchema):
78
+ target_node_label: str = "ECSTaskDefinition"
79
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
80
+ {"id": PropertyRef("taskDefinition")}
81
+ )
82
+ direction: LinkDirection = LinkDirection.OUTWARD
83
+ rel_label: str = "HAS_TASK_DEFINITION"
84
+ properties: ECSServiceToTaskDefinitionRelProperties = (
85
+ ECSServiceToTaskDefinitionRelProperties()
86
+ )
87
+
88
+
89
+ @dataclass(frozen=True)
90
+ class ECSServiceToAWSAccountRelProperties(CartographyRelProperties):
91
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
92
+
93
+
94
+ @dataclass(frozen=True)
95
+ class ECSServiceToAWSAccountRel(CartographyRelSchema):
96
+ target_node_label: str = "AWSAccount"
97
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
98
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
99
+ )
100
+ direction: LinkDirection = LinkDirection.INWARD
101
+ rel_label: str = "RESOURCE"
102
+ properties: ECSServiceToAWSAccountRelProperties = (
103
+ ECSServiceToAWSAccountRelProperties()
104
+ )
105
+
106
+
107
+ @dataclass(frozen=True)
108
+ class ECSServiceSchema(CartographyNodeSchema):
109
+ label: str = "ECSService"
110
+ properties: ECSServiceNodeProperties = ECSServiceNodeProperties()
111
+ sub_resource_relationship: ECSServiceToAWSAccountRel = ECSServiceToAWSAccountRel()
112
+ other_relationships: OtherRelationships = OtherRelationships(
113
+ [
114
+ ECSServiceToECSClusterRel(),
115
+ ECSServiceToTaskDefinitionRel(),
116
+ ]
117
+ )
@@ -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
+ )
@@ -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
+ )
@@ -7,6 +7,7 @@ from cartography.models.core.relationships import CartographyRelProperties
7
7
  from cartography.models.core.relationships import CartographyRelSchema
8
8
  from cartography.models.core.relationships import LinkDirection
9
9
  from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
10
11
  from cartography.models.core.relationships import TargetNodeMatcher
11
12
 
12
13
 
@@ -14,6 +15,7 @@ from cartography.models.core.relationships import TargetNodeMatcher
14
15
  class EfsMountTargetNodeProperties(CartographyNodeProperties):
15
16
  id: PropertyRef = PropertyRef("MountTargetId")
16
17
  arn: PropertyRef = PropertyRef("MountTargetId", extra_index=True)
18
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
17
19
  fileSystem_id: PropertyRef = PropertyRef("FileSystemId")
18
20
  lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
19
21
  mount_target_id: PropertyRef = PropertyRef("MountTargetId")
@@ -33,7 +35,7 @@ class EfsMountTargetToAwsAccountRelProperties(CartographyRelProperties):
33
35
 
34
36
 
35
37
  @dataclass(frozen=True)
36
- class EfsToAWSAccountRel(CartographyRelSchema):
38
+ class EfsMountTargetToAWSAccountRel(CartographyRelSchema):
37
39
  target_node_label: str = "AWSAccount"
38
40
  target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
41
  {"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
@@ -45,8 +47,33 @@ class EfsToAWSAccountRel(CartographyRelSchema):
45
47
  )
46
48
 
47
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
+
48
68
  @dataclass(frozen=True)
49
69
  class EfsMountTargetSchema(CartographyNodeSchema):
50
70
  label: str = "EfsMountTarget"
51
71
  properties: EfsMountTargetNodeProperties = EfsMountTargetNodeProperties()
52
- sub_resource_relationship: EfsToAWSAccountRel = EfsToAWSAccountRel()
72
+ sub_resource_relationship: EfsMountTargetToAWSAccountRel = (
73
+ EfsMountTargetToAWSAccountRel()
74
+ )
75
+ other_relationships: OtherRelationships = OtherRelationships(
76
+ [
77
+ EfsMountTargetToEfsFileSystemRel(),
78
+ ]
79
+ )
@@ -0,0 +1,24 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.relationships import CartographyRelProperties
5
+ from cartography.models.core.relationships import CartographyRelSchema
6
+ from cartography.models.core.relationships import LinkDirection
7
+ from cartography.models.core.relationships import make_target_node_matcher
8
+ from cartography.models.core.relationships import TargetNodeMatcher
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class S3BucketToSNSTopicRelProperties(CartographyRelProperties):
13
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class S3BucketToSNSTopicRel(CartographyRelSchema):
18
+ target_node_label: str = "SNSTopic"
19
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
20
+ {"arn": PropertyRef("TopicArn")},
21
+ )
22
+ direction: LinkDirection = LinkDirection.OUTWARD
23
+ rel_label: str = "NOTIFIES"
24
+ properties: S3BucketToSNSTopicRelProperties = S3BucketToSNSTopicRelProperties()
@@ -91,8 +91,6 @@ class SecretsManagerSecretVersionToKMSKeyRel(CartographyRelSchema):
91
91
  properties: SecretsManagerSecretVersionRelProperties = (
92
92
  SecretsManagerSecretVersionRelProperties()
93
93
  )
94
- # Only create this relationship if KmsKeyId exists
95
- conditional_match_property: str = "KmsKeyId"
96
94
 
97
95
 
98
96
  @dataclass(frozen=True)
File without changes