cartography 0.110.0rc1__py3-none-any.whl → 0.111.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 (59) hide show
  1. cartography/_version.py +16 -3
  2. cartography/cli.py +0 -8
  3. cartography/config.py +0 -9
  4. cartography/data/indexes.cypher +0 -2
  5. cartography/data/jobs/analysis/aws_ec2_keypair_analysis.json +2 -2
  6. cartography/graph/querybuilder.py +70 -0
  7. cartography/intel/aws/apigateway.py +111 -4
  8. cartography/intel/aws/cognito.py +201 -0
  9. cartography/intel/aws/ec2/vpc.py +140 -124
  10. cartography/intel/aws/ecs.py +7 -1
  11. cartography/intel/aws/eventbridge.py +73 -0
  12. cartography/intel/aws/glue.py +64 -0
  13. cartography/intel/aws/kms.py +13 -1
  14. cartography/intel/aws/rds.py +105 -0
  15. cartography/intel/aws/resources.py +2 -0
  16. cartography/intel/aws/route53.py +3 -1
  17. cartography/intel/aws/s3.py +104 -0
  18. cartography/intel/entra/__init__.py +41 -43
  19. cartography/intel/entra/applications.py +2 -1
  20. cartography/intel/entra/ou.py +1 -1
  21. cartography/intel/github/__init__.py +21 -25
  22. cartography/intel/github/repos.py +13 -38
  23. cartography/intel/kubernetes/__init__.py +4 -0
  24. cartography/intel/kubernetes/rbac.py +464 -0
  25. cartography/intel/kubernetes/util.py +17 -0
  26. cartography/models/aws/apigateway/apigatewaydeployment.py +74 -0
  27. cartography/models/aws/cognito/__init__.py +0 -0
  28. cartography/models/aws/cognito/identity_pool.py +70 -0
  29. cartography/models/aws/cognito/user_pool.py +47 -0
  30. cartography/models/aws/ec2/security_groups.py +1 -1
  31. cartography/models/aws/ec2/vpc.py +46 -0
  32. cartography/models/aws/ec2/vpc_cidr.py +102 -0
  33. cartography/models/aws/ecs/services.py +17 -0
  34. cartography/models/aws/ecs/tasks.py +1 -0
  35. cartography/models/aws/eventbridge/target.py +71 -0
  36. cartography/models/aws/glue/job.py +69 -0
  37. cartography/models/aws/rds/event_subscription.py +146 -0
  38. cartography/models/aws/route53/dnsrecord.py +21 -0
  39. cartography/models/github/dependencies.py +1 -2
  40. cartography/models/kubernetes/clusterrolebindings.py +98 -0
  41. cartography/models/kubernetes/clusterroles.py +52 -0
  42. cartography/models/kubernetes/rolebindings.py +119 -0
  43. cartography/models/kubernetes/roles.py +76 -0
  44. cartography/models/kubernetes/serviceaccounts.py +77 -0
  45. cartography/models/tailscale/device.py +1 -0
  46. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/METADATA +3 -3
  47. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/RECORD +57 -43
  48. cartography/data/jobs/cleanup/aws_import_vpc_cleanup.json +0 -23
  49. cartography/intel/entra/resources.py +0 -20
  50. /cartography/data/jobs/{analysis → scoped_analysis}/aws_s3acl_analysis.json +0 -0
  51. /cartography/models/aws/{__init__.py → apigateway/__init__.py} +0 -0
  52. /cartography/models/aws/{apigateway.py → apigateway/apigateway.py} +0 -0
  53. /cartography/models/aws/{apigatewaycertificate.py → apigateway/apigatewaycertificate.py} +0 -0
  54. /cartography/models/aws/{apigatewayresource.py → apigateway/apigatewayresource.py} +0 -0
  55. /cartography/models/aws/{apigatewaystage.py → apigateway/apigatewaystage.py} +0 -0
  56. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/WHEEL +0 -0
  57. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/entry_points.txt +0 -0
  58. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/licenses/LICENSE +0 -0
  59. {cartography-0.110.0rc1.dist-info → cartography-0.111.0rc1.dist-info}/top_level.txt +0 -0
@@ -50,7 +50,7 @@ class EC2SecurityGroupToVpcRel(CartographyRelSchema):
50
50
  target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
51
51
  {"vpcid": PropertyRef("VpcId")}
52
52
  )
53
- direction: LinkDirection = LinkDirection.OUTWARD
53
+ direction: LinkDirection = LinkDirection.INWARD
54
54
  rel_label: str = "MEMBER_OF_EC2_SECURITY_GROUP"
55
55
  properties: EC2SecurityGroupToVpcRelProperties = (
56
56
  EC2SecurityGroupToVpcRelProperties()
@@ -0,0 +1,46 @@
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 VPCNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("VpcId")
16
+ vpcid: PropertyRef = PropertyRef("VpcId", extra_index=True)
17
+ primary_cidr_block: PropertyRef = PropertyRef("PrimaryCIDRBlock")
18
+ instance_tenancy: PropertyRef = PropertyRef("InstanceTenancy")
19
+ state: PropertyRef = PropertyRef("State")
20
+ is_default: PropertyRef = PropertyRef("IsDefault")
21
+ dhcp_options_id: PropertyRef = PropertyRef("DhcpOptionsId")
22
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
23
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ class VPCToAWSAccountRelProperties(CartographyRelProperties):
28
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class VPCToAWSAccountRel(CartographyRelSchema):
33
+ target_node_label: str = "AWSAccount"
34
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
35
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
36
+ )
37
+ direction: LinkDirection = LinkDirection.INWARD
38
+ rel_label: str = "RESOURCE"
39
+ properties: VPCToAWSAccountRelProperties = VPCToAWSAccountRelProperties()
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class AWSVpcSchema(CartographyNodeSchema):
44
+ label: str = "AWSVpc"
45
+ properties: VPCNodeProperties = VPCNodeProperties()
46
+ sub_resource_relationship: VPCToAWSAccountRel = VPCToAWSAccountRel()
@@ -0,0 +1,102 @@
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.nodes import ExtraNodeLabels
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class AWSIPv4CidrBlockNodeProperties(CartographyNodeProperties):
17
+ id: PropertyRef = PropertyRef("Id")
18
+ vpcid: PropertyRef = PropertyRef("VpcId")
19
+ association_id: PropertyRef = PropertyRef("AssociationId")
20
+ cidr_block: PropertyRef = PropertyRef("CidrBlock")
21
+ block_state: PropertyRef = PropertyRef("BlockState")
22
+ block_state_message: PropertyRef = PropertyRef("BlockStateMessage")
23
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ class AWSIPv4CidrBlockToAWSVpcRelProperties(CartographyRelProperties):
28
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class AWSIPv4CidrBlockToAWSVpcRel(CartographyRelSchema):
33
+ target_node_label: str = "AWSVpc"
34
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
35
+ {"id": PropertyRef("VpcId")}
36
+ )
37
+ direction: LinkDirection = LinkDirection.INWARD
38
+ rel_label: str = "BLOCK_ASSOCIATION"
39
+ properties: AWSIPv4CidrBlockToAWSVpcRelProperties = (
40
+ AWSIPv4CidrBlockToAWSVpcRelProperties()
41
+ )
42
+
43
+
44
+ @dataclass(frozen=True)
45
+ class AWSIPv4CidrBlockSchema(CartographyNodeSchema):
46
+ """
47
+ There is no sub-resource relationship here because a
48
+ CIDR block can be associated with more than one account
49
+ and it doesn't make sense to scope it to one.
50
+ """
51
+
52
+ label: str = "AWSCidrBlock"
53
+ properties: AWSIPv4CidrBlockNodeProperties = AWSIPv4CidrBlockNodeProperties()
54
+ other_relationships: OtherRelationships = OtherRelationships(
55
+ [AWSIPv4CidrBlockToAWSVpcRel()]
56
+ )
57
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["AWSIpv4CidrBlock"])
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class AWSIPv6CidrBlockNodeProperties(CartographyNodeProperties):
62
+ id: PropertyRef = PropertyRef("Id")
63
+ vpcid: PropertyRef = PropertyRef("VpcId")
64
+ association_id: PropertyRef = PropertyRef("AssociationId")
65
+ cidr_block: PropertyRef = PropertyRef("CidrBlock")
66
+ block_state: PropertyRef = PropertyRef("BlockState")
67
+ block_state_message: PropertyRef = PropertyRef("BlockStateMessage")
68
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class AWSIPv6CidrBlockToAWSVpcRelProperties(CartographyRelProperties):
73
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
74
+
75
+
76
+ @dataclass(frozen=True)
77
+ class AWSIPv6CidrBlockToAWSVpcRel(CartographyRelSchema):
78
+ target_node_label: str = "AWSVpc"
79
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
80
+ {"id": PropertyRef("VpcId")}
81
+ )
82
+ direction: LinkDirection = LinkDirection.INWARD
83
+ rel_label: str = "BLOCK_ASSOCIATION"
84
+ properties: AWSIPv6CidrBlockToAWSVpcRelProperties = (
85
+ AWSIPv6CidrBlockToAWSVpcRelProperties()
86
+ )
87
+
88
+
89
+ @dataclass(frozen=True)
90
+ class AWSIPv6CidrBlockSchema(CartographyNodeSchema):
91
+ """
92
+ There is no sub-resource relationship here because a
93
+ CIDR block can be associated with more than one account
94
+ and it doesn't make sense to scope it to one.
95
+ """
96
+
97
+ label: str = "AWSCidrBlock"
98
+ properties: AWSIPv6CidrBlockNodeProperties = AWSIPv6CidrBlockNodeProperties()
99
+ other_relationships: OtherRelationships = OtherRelationships(
100
+ [AWSIPv6CidrBlockToAWSVpcRel()]
101
+ )
102
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["AWSIpv6CidrBlock"])
@@ -104,6 +104,22 @@ class ECSServiceToAWSAccountRel(CartographyRelSchema):
104
104
  )
105
105
 
106
106
 
107
+ @dataclass(frozen=True)
108
+ class ECSServiceToECSTaskRelProperties(CartographyRelProperties):
109
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
110
+
111
+
112
+ @dataclass(frozen=True)
113
+ class ECSServiceToECSTaskRel(CartographyRelSchema):
114
+ target_node_label: str = "ECSTask"
115
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
116
+ {"service_name": PropertyRef("serviceName")}
117
+ )
118
+ direction: LinkDirection = LinkDirection.OUTWARD
119
+ rel_label: str = "HAS_TASK"
120
+ properties: ECSServiceToECSTaskRelProperties = ECSServiceToECSTaskRelProperties()
121
+
122
+
107
123
  @dataclass(frozen=True)
108
124
  class ECSServiceSchema(CartographyNodeSchema):
109
125
  label: str = "ECSService"
@@ -113,5 +129,6 @@ class ECSServiceSchema(CartographyNodeSchema):
113
129
  [
114
130
  ECSServiceToECSClusterRel(),
115
131
  ECSServiceToTaskDefinitionRel(),
132
+ ECSServiceToECSTaskRel(),
116
133
  ]
117
134
  )
@@ -27,6 +27,7 @@ class ECSTaskNodeProperties(CartographyNodeProperties):
27
27
  enable_execute_command: PropertyRef = PropertyRef("enableExecuteCommand")
28
28
  execution_stopped_at: PropertyRef = PropertyRef("executionStoppedAt")
29
29
  group: PropertyRef = PropertyRef("group")
30
+ service_name: PropertyRef = PropertyRef("serviceName")
30
31
  health_status: PropertyRef = PropertyRef("healthStatus")
31
32
  last_status: PropertyRef = PropertyRef("lastStatus")
32
33
  launch_type: PropertyRef = PropertyRef("launchType")
@@ -0,0 +1,71 @@
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 EventBridgeTargetNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("Id")
17
+ arn: PropertyRef = PropertyRef("Arn", extra_index=True)
18
+ rule_arn: PropertyRef = PropertyRef("RuleArn")
19
+ role_arn: PropertyRef = PropertyRef("RoleArn")
20
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
21
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class EventBridgeTargetToAwsAccountRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class EventBridgeTargetToAWSAccountRel(CartographyRelSchema):
31
+ target_node_label: str = "AWSAccount"
32
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
33
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
34
+ )
35
+ direction: LinkDirection = LinkDirection.INWARD
36
+ rel_label: str = "RESOURCE"
37
+ properties: EventBridgeTargetToAwsAccountRelProperties = (
38
+ EventBridgeTargetToAwsAccountRelProperties()
39
+ )
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class EventBridgeTargetToEventBridgeRuleRelProperties(CartographyRelProperties):
44
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class EventBridgeTargetToEventBridgeRuleRel(CartographyRelSchema):
49
+ target_node_label: str = "EventBridgeRule"
50
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
51
+ {"arn": PropertyRef("RuleArn")},
52
+ )
53
+ direction: LinkDirection = LinkDirection.OUTWARD
54
+ rel_label: str = "LINKED_TO_RULE"
55
+ properties: EventBridgeTargetToEventBridgeRuleRelProperties = (
56
+ EventBridgeTargetToEventBridgeRuleRelProperties()
57
+ )
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class EventBridgeTargetSchema(CartographyNodeSchema):
62
+ label: str = "EventBridgeTarget"
63
+ properties: EventBridgeTargetNodeProperties = EventBridgeTargetNodeProperties()
64
+ sub_resource_relationship: EventBridgeTargetToAWSAccountRel = (
65
+ EventBridgeTargetToAWSAccountRel()
66
+ )
67
+ other_relationships: OtherRelationships = OtherRelationships(
68
+ [
69
+ EventBridgeTargetToEventBridgeRuleRel(),
70
+ ]
71
+ )
@@ -0,0 +1,69 @@
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 GlueJobNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("Name")
17
+ arn: PropertyRef = PropertyRef("Name", extra_index=True)
18
+ profile_name: PropertyRef = PropertyRef("ProfileName")
19
+ job_mode: PropertyRef = PropertyRef("JobMode")
20
+ connections: PropertyRef = PropertyRef("Connections")
21
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
22
+ description: PropertyRef = PropertyRef("Description")
23
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ class GlueJobToAwsAccountRelProperties(CartographyRelProperties):
28
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class GlueJobToAWSAccountRel(CartographyRelSchema):
33
+ target_node_label: str = "AWSAccount"
34
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
35
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
36
+ )
37
+ direction: LinkDirection = LinkDirection.INWARD
38
+ rel_label: str = "RESOURCE"
39
+ properties: GlueJobToAwsAccountRelProperties = GlueJobToAwsAccountRelProperties()
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class GlueJobToGlueConnectionRelProperties(CartographyRelProperties):
44
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class GlueJobToGlueConnectionRel(CartographyRelSchema):
49
+ target_node_label: str = "GlueConnection"
50
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
51
+ {"id": PropertyRef("Connections", one_to_many=True)},
52
+ )
53
+ direction: LinkDirection = LinkDirection.OUTWARD
54
+ rel_label: str = "USES"
55
+ properties: GlueJobToGlueConnectionRelProperties = (
56
+ GlueJobToGlueConnectionRelProperties()
57
+ )
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class GlueJobSchema(CartographyNodeSchema):
62
+ label: str = "GlueJob"
63
+ properties: GlueJobNodeProperties = GlueJobNodeProperties()
64
+ sub_resource_relationship: GlueJobToAWSAccountRel = GlueJobToAWSAccountRel()
65
+ other_relationships: OtherRelationships = OtherRelationships(
66
+ [
67
+ GlueJobToGlueConnectionRel(),
68
+ ]
69
+ )
@@ -0,0 +1,146 @@
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 RDSEventSubscriptionNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("CustSubscriptionId")
17
+ arn: PropertyRef = PropertyRef("EventSubscriptionArn", extra_index=True)
18
+ customer_aws_id: PropertyRef = PropertyRef("CustomerAwsId")
19
+ sns_topic_arn: PropertyRef = PropertyRef("SnsTopicArn")
20
+ source_type: PropertyRef = PropertyRef("SourceType")
21
+ status: PropertyRef = PropertyRef("Status")
22
+ enabled: PropertyRef = PropertyRef("Enabled")
23
+ subscription_creation_time: PropertyRef = PropertyRef("SubscriptionCreationTime")
24
+ event_categories: PropertyRef = PropertyRef("event_categories", one_to_many=True)
25
+ source_ids: PropertyRef = PropertyRef("source_ids", one_to_many=True)
26
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
27
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class RDSEventSubscriptionToAWSAccountRelProperties(CartographyRelProperties):
32
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class RDSEventSubscriptionToAWSAccountRel(CartographyRelSchema):
37
+ target_node_label: str = "AWSAccount"
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {
40
+ "id": PropertyRef("AWS_ID", set_in_kwargs=True),
41
+ }
42
+ )
43
+ direction: LinkDirection = LinkDirection.INWARD
44
+ rel_label: str = "RESOURCE"
45
+ properties: RDSEventSubscriptionToAWSAccountRelProperties = (
46
+ RDSEventSubscriptionToAWSAccountRelProperties()
47
+ )
48
+
49
+
50
+ @dataclass(frozen=True)
51
+ class RDSEventSubscriptionToSNSTopicRelProperties(CartographyRelProperties):
52
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
53
+
54
+
55
+ @dataclass(frozen=True)
56
+ class RDSEventSubscriptionToSNSTopicRel(CartographyRelSchema):
57
+ target_node_label: str = "SNSTopic"
58
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
59
+ {
60
+ "arn": PropertyRef("SnsTopicArn"),
61
+ }
62
+ )
63
+ direction: LinkDirection = LinkDirection.OUTWARD
64
+ rel_label: str = "NOTIFIES"
65
+ properties: RDSEventSubscriptionToSNSTopicRelProperties = (
66
+ RDSEventSubscriptionToSNSTopicRelProperties()
67
+ )
68
+
69
+
70
+ @dataclass(frozen=True)
71
+ class RDSEventSubscriptionToRDSInstanceRelProperties(CartographyRelProperties):
72
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
73
+
74
+
75
+ @dataclass(frozen=True)
76
+ class RDSEventSubscriptionToRDSInstanceRel(CartographyRelSchema):
77
+ target_node_label: str = "RDSInstance"
78
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
79
+ {
80
+ "db_instance_identifier": PropertyRef("source_ids", one_to_many=True),
81
+ }
82
+ )
83
+ direction: LinkDirection = LinkDirection.OUTWARD
84
+ rel_label: str = "MONITORS"
85
+ properties: RDSEventSubscriptionToRDSInstanceRelProperties = (
86
+ RDSEventSubscriptionToRDSInstanceRelProperties()
87
+ )
88
+
89
+
90
+ @dataclass(frozen=True)
91
+ class RDSEventSubscriptionToRDSClusterRelProperties(CartographyRelProperties):
92
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
93
+
94
+
95
+ @dataclass(frozen=True)
96
+ class RDSEventSubscriptionToRDSClusterRel(CartographyRelSchema):
97
+ target_node_label: str = "RDSCluster"
98
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
99
+ {
100
+ "db_cluster_identifier": PropertyRef("source_ids", one_to_many=True),
101
+ }
102
+ )
103
+ direction: LinkDirection = LinkDirection.OUTWARD
104
+ rel_label: str = "MONITORS"
105
+ properties: RDSEventSubscriptionToRDSClusterRelProperties = (
106
+ RDSEventSubscriptionToRDSClusterRelProperties()
107
+ )
108
+
109
+
110
+ @dataclass(frozen=True)
111
+ class RDSEventSubscriptionToRDSSnapshotRelProperties(CartographyRelProperties):
112
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
113
+
114
+
115
+ @dataclass(frozen=True)
116
+ class RDSEventSubscriptionToRDSSnapshotRel(CartographyRelSchema):
117
+ target_node_label: str = "RDSSnapshot"
118
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
119
+ {
120
+ "db_snapshot_identifier": PropertyRef("source_ids", one_to_many=True),
121
+ }
122
+ )
123
+ direction: LinkDirection = LinkDirection.OUTWARD
124
+ rel_label: str = "MONITORS"
125
+ properties: RDSEventSubscriptionToRDSSnapshotRelProperties = (
126
+ RDSEventSubscriptionToRDSSnapshotRelProperties()
127
+ )
128
+
129
+
130
+ @dataclass(frozen=True)
131
+ class RDSEventSubscriptionSchema(CartographyNodeSchema):
132
+ label: str = "RDSEventSubscription"
133
+ properties: RDSEventSubscriptionNodeProperties = (
134
+ RDSEventSubscriptionNodeProperties()
135
+ )
136
+ sub_resource_relationship: RDSEventSubscriptionToAWSAccountRel = (
137
+ RDSEventSubscriptionToAWSAccountRel()
138
+ )
139
+ other_relationships: OtherRelationships = OtherRelationships(
140
+ [
141
+ RDSEventSubscriptionToSNSTopicRel(),
142
+ RDSEventSubscriptionToRDSInstanceRel(),
143
+ RDSEventSubscriptionToRDSClusterRel(),
144
+ RDSEventSubscriptionToRDSSnapshotRel(),
145
+ ]
146
+ )
@@ -193,6 +193,26 @@ class AWSDNSRecordToIpRel(CartographyRelSchema):
193
193
  properties: AWSDNSRecordToIpRelProperties = AWSDNSRecordToIpRelProperties()
194
194
 
195
195
 
196
+ @dataclass(frozen=True)
197
+ class AWSDNSRecordToElasticIPAddressRelProperties(CartographyRelProperties):
198
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
199
+
200
+
201
+ @dataclass(frozen=True)
202
+ class AWSDNSRecordToElasticIPAddressRel(CartographyRelSchema):
203
+ target_node_label: str = "ElasticIPAddress"
204
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
205
+ {
206
+ "public_ip": PropertyRef("value"),
207
+ }
208
+ )
209
+ direction: LinkDirection = LinkDirection.OUTWARD
210
+ rel_label: str = "DNS_POINTS_TO"
211
+ properties: AWSDNSRecordToElasticIPAddressRelProperties = (
212
+ AWSDNSRecordToElasticIPAddressRelProperties()
213
+ )
214
+
215
+
196
216
  class AWSDNSRecordSchema(CartographyNodeSchema):
197
217
  label: str = "AWSDNSRecord"
198
218
  properties: AWSDNSRecordNodeProperties = AWSDNSRecordNodeProperties()
@@ -210,5 +230,6 @@ class AWSDNSRecordSchema(CartographyNodeSchema):
210
230
  AWSDNSRecordToDNSRecordRel(),
211
231
  AWSDNSRecordToZoneRel(),
212
232
  AWSDNSRecordToIpRel(),
233
+ AWSDNSRecordToElasticIPAddressRel(),
213
234
  ]
214
235
  )
@@ -16,10 +16,9 @@ class GitHubDependencyNodeProperties(CartographyNodeProperties):
16
16
  id: PropertyRef = PropertyRef("id")
17
17
  name: PropertyRef = PropertyRef("name")
18
18
  original_name: PropertyRef = PropertyRef("original_name")
19
- version: PropertyRef = PropertyRef("version")
19
+ requirements: PropertyRef = PropertyRef("requirements")
20
20
  ecosystem: PropertyRef = PropertyRef("ecosystem")
21
21
  package_manager: PropertyRef = PropertyRef("package_manager")
22
- repo_name: PropertyRef = PropertyRef("repo_name")
23
22
  manifest_file: PropertyRef = PropertyRef("manifest_file")
24
23
  lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
25
24
 
@@ -0,0 +1,98 @@
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 KubernetesClusterRoleBindingNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name")
18
+ uid: PropertyRef = PropertyRef("uid")
19
+ creation_timestamp: PropertyRef = PropertyRef("creation_timestamp")
20
+ resource_version: PropertyRef = PropertyRef("resource_version")
21
+ role_name: PropertyRef = PropertyRef("role_name")
22
+ role_kind: PropertyRef = PropertyRef("role_kind")
23
+ service_account_ids: PropertyRef = PropertyRef("service_account_ids")
24
+ role_id: PropertyRef = PropertyRef("role_id")
25
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class KubernetesClusterRoleBindingToClusterRelProperties(CartographyRelProperties):
30
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
31
+
32
+
33
+ @dataclass(frozen=True)
34
+ class KubernetesClusterRoleBindingToClusterRel(CartographyRelSchema):
35
+ target_node_label: str = "KubernetesCluster"
36
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
37
+ {"id": PropertyRef("CLUSTER_ID", set_in_kwargs=True)}
38
+ )
39
+ direction: LinkDirection = LinkDirection.INWARD
40
+ rel_label: str = "RESOURCE"
41
+ properties: KubernetesClusterRoleBindingToClusterRelProperties = (
42
+ KubernetesClusterRoleBindingToClusterRelProperties()
43
+ )
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class KubernetesClusterRoleBindingToServiceAccountRelProperties(
48
+ CartographyRelProperties
49
+ ):
50
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class KubernetesClusterRoleBindingToServiceAccountRel(CartographyRelSchema):
55
+ target_node_label: str = "KubernetesServiceAccount"
56
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
57
+ {"id": PropertyRef("service_account_ids", one_to_many=True)}
58
+ )
59
+ direction: LinkDirection = LinkDirection.OUTWARD
60
+ rel_label: str = "SUBJECT"
61
+ properties: KubernetesClusterRoleBindingToServiceAccountRelProperties = (
62
+ KubernetesClusterRoleBindingToServiceAccountRelProperties()
63
+ )
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ class KubernetesClusterRoleBindingToClusterRoleRelProperties(CartographyRelProperties):
68
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class KubernetesClusterRoleBindingToClusterRoleRel(CartographyRelSchema):
73
+ target_node_label: str = "KubernetesClusterRole"
74
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
75
+ {"id": PropertyRef("role_id")}
76
+ )
77
+ direction: LinkDirection = LinkDirection.OUTWARD
78
+ rel_label: str = "ROLE_REF"
79
+ properties: KubernetesClusterRoleBindingToClusterRoleRelProperties = (
80
+ KubernetesClusterRoleBindingToClusterRoleRelProperties()
81
+ )
82
+
83
+
84
+ @dataclass(frozen=True)
85
+ class KubernetesClusterRoleBindingSchema(CartographyNodeSchema):
86
+ label: str = "KubernetesClusterRoleBinding"
87
+ properties: KubernetesClusterRoleBindingNodeProperties = (
88
+ KubernetesClusterRoleBindingNodeProperties()
89
+ )
90
+ sub_resource_relationship: KubernetesClusterRoleBindingToClusterRel = (
91
+ KubernetesClusterRoleBindingToClusterRel()
92
+ )
93
+ other_relationships: OtherRelationships = OtherRelationships(
94
+ [
95
+ KubernetesClusterRoleBindingToServiceAccountRel(),
96
+ KubernetesClusterRoleBindingToClusterRoleRel(),
97
+ ]
98
+ )