cartography 0.103.0rc1__py3-none-any.whl → 0.104.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 (75) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +97 -1
  3. cartography/config.py +28 -0
  4. cartography/graph/cleanupbuilder.py +151 -41
  5. cartography/intel/anthropic/__init__.py +62 -0
  6. cartography/intel/anthropic/apikeys.py +72 -0
  7. cartography/intel/anthropic/users.py +75 -0
  8. cartography/intel/anthropic/util.py +51 -0
  9. cartography/intel/anthropic/workspaces.py +95 -0
  10. cartography/intel/aws/cloudtrail.py +3 -38
  11. cartography/intel/aws/cloudwatch.py +93 -0
  12. cartography/intel/aws/ec2/load_balancer_v2s.py +4 -1
  13. cartography/intel/aws/resources.py +2 -0
  14. cartography/intel/aws/secretsmanager.py +150 -3
  15. cartography/intel/aws/ssm.py +71 -0
  16. cartography/intel/cloudflare/__init__.py +74 -0
  17. cartography/intel/cloudflare/accounts.py +57 -0
  18. cartography/intel/cloudflare/dnsrecords.py +64 -0
  19. cartography/intel/cloudflare/members.py +75 -0
  20. cartography/intel/cloudflare/roles.py +65 -0
  21. cartography/intel/cloudflare/zones.py +64 -0
  22. cartography/intel/entra/ou.py +21 -5
  23. cartography/intel/openai/__init__.py +86 -0
  24. cartography/intel/openai/adminapikeys.py +89 -0
  25. cartography/intel/openai/apikeys.py +96 -0
  26. cartography/intel/openai/projects.py +97 -0
  27. cartography/intel/openai/serviceaccounts.py +82 -0
  28. cartography/intel/openai/users.py +75 -0
  29. cartography/intel/openai/util.py +45 -0
  30. cartography/intel/tailscale/__init__.py +77 -0
  31. cartography/intel/tailscale/acls.py +146 -0
  32. cartography/intel/tailscale/devices.py +127 -0
  33. cartography/intel/tailscale/postureintegrations.py +81 -0
  34. cartography/intel/tailscale/tailnets.py +76 -0
  35. cartography/intel/tailscale/users.py +80 -0
  36. cartography/intel/tailscale/utils.py +132 -0
  37. cartography/models/anthropic/__init__.py +0 -0
  38. cartography/models/anthropic/apikey.py +90 -0
  39. cartography/models/anthropic/organization.py +19 -0
  40. cartography/models/anthropic/user.py +48 -0
  41. cartography/models/anthropic/workspace.py +90 -0
  42. cartography/models/aws/cloudtrail/trail.py +24 -0
  43. cartography/models/aws/cloudwatch/__init__.py +0 -0
  44. cartography/models/aws/cloudwatch/loggroup.py +52 -0
  45. cartography/models/aws/secretsmanager/__init__.py +0 -0
  46. cartography/models/aws/secretsmanager/secret_version.py +116 -0
  47. cartography/models/aws/ssm/parameters.py +84 -0
  48. cartography/models/cloudflare/__init__.py +0 -0
  49. cartography/models/cloudflare/account.py +25 -0
  50. cartography/models/cloudflare/dnsrecord.py +55 -0
  51. cartography/models/cloudflare/member.py +82 -0
  52. cartography/models/cloudflare/role.py +44 -0
  53. cartography/models/cloudflare/zone.py +59 -0
  54. cartography/models/core/nodes.py +15 -2
  55. cartography/models/openai/__init__.py +0 -0
  56. cartography/models/openai/adminapikey.py +90 -0
  57. cartography/models/openai/apikey.py +84 -0
  58. cartography/models/openai/organization.py +17 -0
  59. cartography/models/openai/project.py +89 -0
  60. cartography/models/openai/serviceaccount.py +50 -0
  61. cartography/models/openai/user.py +49 -0
  62. cartography/models/tailscale/__init__.py +0 -0
  63. cartography/models/tailscale/device.py +95 -0
  64. cartography/models/tailscale/group.py +86 -0
  65. cartography/models/tailscale/postureintegration.py +58 -0
  66. cartography/models/tailscale/tag.py +102 -0
  67. cartography/models/tailscale/tailnet.py +29 -0
  68. cartography/models/tailscale/user.py +52 -0
  69. cartography/sync.py +8 -0
  70. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.dist-info}/METADATA +8 -4
  71. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.dist-info}/RECORD +75 -19
  72. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.dist-info}/WHEEL +1 -1
  73. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.dist-info}/entry_points.txt +0 -0
  74. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.dist-info}/licenses/LICENSE +0 -0
  75. {cartography-0.103.0rc1.dist-info → cartography-0.104.0.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 SSMParameterNodeProperties(CartographyNodeProperties):
16
+
17
+ arn: PropertyRef = PropertyRef("ARN", extra_index=True)
18
+ id: PropertyRef = PropertyRef("ARN")
19
+ name: PropertyRef = PropertyRef("Name")
20
+ description: PropertyRef = PropertyRef("Description")
21
+ type: PropertyRef = PropertyRef("Type")
22
+ keyid: PropertyRef = PropertyRef("KeyId")
23
+ kms_key_id_short: PropertyRef = PropertyRef("KMSKeyIdShort")
24
+ version: PropertyRef = PropertyRef("Version")
25
+ lastmodifieddate: PropertyRef = PropertyRef("LastModifiedDate")
26
+ tier: PropertyRef = PropertyRef("Tier")
27
+ lastmodifieduser: PropertyRef = PropertyRef("LastModifiedUser")
28
+ datatype: PropertyRef = PropertyRef("DataType")
29
+ allowedpattern: PropertyRef = PropertyRef("AllowedPattern")
30
+ policies_json: PropertyRef = PropertyRef("PoliciesJson")
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 SSMParameterToAWSAccountRelProperties(CartographyRelProperties):
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class SSMParameterToAWSAccountRel(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: SSMParameterToAWSAccountRelProperties = (
49
+ SSMParameterToAWSAccountRelProperties()
50
+ )
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class SSMParameterToKMSKeyRelProperties(CartographyRelProperties):
55
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class SSMParameterToKMSKeyRel(CartographyRelSchema):
60
+ target_node_label: str = "KMSKey"
61
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
62
+ {
63
+ "id": PropertyRef("KMSKeyIdShort"),
64
+ }
65
+ )
66
+ direction: LinkDirection = LinkDirection.OUTWARD
67
+ rel_label: str = "ENCRYPTED_BY"
68
+ properties: SSMParameterToKMSKeyRelProperties = SSMParameterToKMSKeyRelProperties()
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class SSMParameterSchema(CartographyNodeSchema):
73
+
74
+ label: str = "SSMParameter"
75
+ properties: SSMParameterNodeProperties = SSMParameterNodeProperties()
76
+ sub_resource_relationship: SSMParameterToAWSAccountRel = (
77
+ SSMParameterToAWSAccountRel()
78
+ )
79
+
80
+ other_relationships: OtherRelationships = OtherRelationships(
81
+ [
82
+ SSMParameterToKMSKeyRel(),
83
+ ],
84
+ )
File without changes
@@ -0,0 +1,25 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class CloudflareAccountNodeProperties(CartographyNodeProperties):
10
+ created_on: PropertyRef = PropertyRef("created_on")
11
+ name: PropertyRef = PropertyRef("name")
12
+ abuse_contact_email: PropertyRef = PropertyRef("settings.abuse_contact_email")
13
+ default_nameservers: PropertyRef = PropertyRef("settings.default_nameservers")
14
+ enforce_twofactor: PropertyRef = PropertyRef("settings.enforce_twofactor")
15
+ use_account_custom_ns_by_default: PropertyRef = PropertyRef(
16
+ "settings.use_account_custom_ns_by_default"
17
+ )
18
+ id: PropertyRef = PropertyRef("id")
19
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class CloudflareAccountSchema(CartographyNodeSchema):
24
+ label: str = "CloudflareAccount"
25
+ properties: CloudflareAccountNodeProperties = CloudflareAccountNodeProperties()
@@ -0,0 +1,55 @@
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 TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class CloudflareDNSRecordNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name", extra_index=True)
18
+ value: PropertyRef = PropertyRef("content")
19
+ type: PropertyRef = PropertyRef("type")
20
+ comment: PropertyRef = PropertyRef("comment")
21
+ proxied: PropertyRef = PropertyRef("proxied")
22
+ ttl: PropertyRef = PropertyRef("ttl")
23
+ created_on: PropertyRef = PropertyRef("created_on")
24
+ modified_on: PropertyRef = PropertyRef("modified_on")
25
+ proxiable: PropertyRef = PropertyRef("proxiable")
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class CloudflareDNSRecordToZoneRelProperties(CartographyRelProperties):
31
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ # (:CloudflareDNSRecord)<-[:RESOURCE]-(:CloudflareZone)
36
+ class CloudflareDNSRecordToZoneRel(CartographyRelSchema):
37
+ target_node_label: str = "CloudflareZone"
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {"id": PropertyRef("zone_id", set_in_kwargs=True)},
40
+ )
41
+ direction: LinkDirection = LinkDirection.INWARD
42
+ rel_label: str = "RESOURCE"
43
+ properties: CloudflareDNSRecordToZoneRelProperties = (
44
+ CloudflareDNSRecordToZoneRelProperties()
45
+ )
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class CloudflareDNSRecordSchema(CartographyNodeSchema):
50
+ label: str = "CloudflareDNSRecord"
51
+ properties: CloudflareDNSRecordNodeProperties = CloudflareDNSRecordNodeProperties()
52
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["DNSRecord"])
53
+ sub_resource_relationship: CloudflareDNSRecordToZoneRel = (
54
+ CloudflareDNSRecordToZoneRel()
55
+ )
@@ -0,0 +1,82 @@
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 CloudflareMemberNodeProperties(CartographyNodeProperties):
16
+ status: PropertyRef = PropertyRef("status")
17
+ email: PropertyRef = PropertyRef("user.email")
18
+ firstname: PropertyRef = PropertyRef("user.first_name")
19
+ user_id: PropertyRef = PropertyRef("user.id")
20
+ lastname: PropertyRef = PropertyRef("user.last_name")
21
+ two_factor_authentication_enabled: PropertyRef = PropertyRef(
22
+ "user.two_factor_authentication_enabled"
23
+ )
24
+ id: PropertyRef = PropertyRef("id")
25
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class CloudflareMemberToAccountRelProperties(CartographyRelProperties):
30
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
31
+
32
+
33
+ @dataclass(frozen=True)
34
+ # (:CloudflareMember)<-[:RESOURCE]-(:CloudflareAccount)
35
+ class CloudflareMemberToAccountRel(CartographyRelSchema):
36
+ target_node_label: str = "CloudflareAccount"
37
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
38
+ {"id": PropertyRef("account_id", set_in_kwargs=True)},
39
+ )
40
+ direction: LinkDirection = LinkDirection.INWARD
41
+ rel_label: str = "RESOURCE"
42
+ properties: CloudflareMemberToAccountRelProperties = (
43
+ CloudflareMemberToAccountRelProperties()
44
+ )
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class CloudflareMemberToCloudflareRoleProperties(CartographyRelProperties):
49
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
50
+
51
+
52
+ @dataclass(frozen=True)
53
+ # (:CloudflareRole)<-[:HAS_ROLE]-(:CloudflareMember)
54
+ class CloudflareMemberToCloudflareRoleRel(CartographyRelSchema):
55
+ target_node_label: str = "CloudflareRole"
56
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
57
+ {
58
+ "id": PropertyRef(
59
+ "roles_ids",
60
+ one_to_many=True,
61
+ )
62
+ },
63
+ )
64
+ direction: LinkDirection = LinkDirection.OUTWARD
65
+ rel_label: str = "HAS_ROLE"
66
+ properties: CloudflareMemberToCloudflareRoleProperties = (
67
+ CloudflareMemberToCloudflareRoleProperties()
68
+ )
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class CloudflareMemberSchema(CartographyNodeSchema):
73
+ label: str = "CloudflareMember"
74
+ properties: CloudflareMemberNodeProperties = CloudflareMemberNodeProperties()
75
+ sub_resource_relationship: CloudflareMemberToAccountRel = (
76
+ CloudflareMemberToAccountRel()
77
+ )
78
+ other_relationships: OtherRelationships = OtherRelationships(
79
+ [
80
+ CloudflareMemberToCloudflareRoleRel(),
81
+ ],
82
+ )
@@ -0,0 +1,44 @@
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 CloudflareRoleNodeProperties(CartographyNodeProperties):
15
+ description: PropertyRef = PropertyRef("description")
16
+ name: PropertyRef = PropertyRef("name")
17
+ id: PropertyRef = PropertyRef("id")
18
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class CloudflareRoleToAccountRelProperties(CartographyRelProperties):
23
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ # (:CloudflareRole)<-[:RESOURCE]-(:CloudflareAccount)
28
+ class CloudflareRoleToAccountRel(CartographyRelSchema):
29
+ target_node_label: str = "CloudflareAccount"
30
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
31
+ {"id": PropertyRef("account_id", set_in_kwargs=True)},
32
+ )
33
+ direction: LinkDirection = LinkDirection.INWARD
34
+ rel_label: str = "RESOURCE"
35
+ properties: CloudflareRoleToAccountRelProperties = (
36
+ CloudflareRoleToAccountRelProperties()
37
+ )
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class CloudflareRoleSchema(CartographyNodeSchema):
42
+ label: str = "CloudflareRole"
43
+ properties: CloudflareRoleNodeProperties = CloudflareRoleNodeProperties()
44
+ sub_resource_relationship: CloudflareRoleToAccountRel = CloudflareRoleToAccountRel()
@@ -0,0 +1,59 @@
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 CloudflareZoneNodeProperties(CartographyNodeProperties):
15
+ activated_on: PropertyRef = PropertyRef("activated_on")
16
+ created_on: PropertyRef = PropertyRef("created_on")
17
+ development_mode: PropertyRef = PropertyRef("development_mode")
18
+ cdn_only: PropertyRef = PropertyRef("meta.cdn_only")
19
+ custom_certificate_quota: PropertyRef = PropertyRef("meta.custom_certificate_quota")
20
+ dns_only: PropertyRef = PropertyRef("meta.dns_only")
21
+ foundation_dns: PropertyRef = PropertyRef("meta.foundation_dns")
22
+ page_rule_quota: PropertyRef = PropertyRef("meta.page_rule_quota")
23
+ phishing_detected: PropertyRef = PropertyRef("meta.phishing_detected")
24
+ modified_on: PropertyRef = PropertyRef("modified_on")
25
+ name: PropertyRef = PropertyRef("name")
26
+ original_dnshost: PropertyRef = PropertyRef("original_dnshost")
27
+ original_registrar: PropertyRef = PropertyRef("original_registrar")
28
+ status: PropertyRef = PropertyRef("status")
29
+ verification_key: PropertyRef = PropertyRef("verification_key")
30
+ id: PropertyRef = PropertyRef("id")
31
+ paused: PropertyRef = PropertyRef("paused")
32
+ type: PropertyRef = PropertyRef("type")
33
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
34
+
35
+
36
+ @dataclass(frozen=True)
37
+ class CloudflareZoneToAccountRelProperties(CartographyRelProperties):
38
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ # (:CloudflareZone)<-[:RESOURCE]-(:CloudflareAccount)
43
+ class CloudflareZoneToAccountRel(CartographyRelSchema):
44
+ target_node_label: str = "CloudflareAccount"
45
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
46
+ {"id": PropertyRef("account_id", set_in_kwargs=True)},
47
+ )
48
+ direction: LinkDirection = LinkDirection.INWARD
49
+ rel_label: str = "RESOURCE"
50
+ properties: CloudflareZoneToAccountRelProperties = (
51
+ CloudflareZoneToAccountRelProperties()
52
+ )
53
+
54
+
55
+ @dataclass(frozen=True)
56
+ class CloudflareZoneSchema(CartographyNodeSchema):
57
+ label: str = "CloudflareZone"
58
+ properties: CloudflareZoneNodeProperties = CloudflareZoneNodeProperties()
59
+ sub_resource_relationship: CloudflareZoneToAccountRel = CloudflareZoneToAccountRel()
@@ -91,7 +91,7 @@ class CartographyNodeSchema(abc.ABC):
91
91
  """
92
92
  Optional.
93
93
  Allows subclasses to specify additional cartography relationships on the node.
94
- :return: None if not overriden. Else return the node's OtherRelationships.
94
+ :return: None if not overridden. Else return the node's OtherRelationships.
95
95
  """
96
96
  return None
97
97
 
@@ -100,6 +100,19 @@ class CartographyNodeSchema(abc.ABC):
100
100
  """
101
101
  Optional.
102
102
  Allows specifying extra labels on the node.
103
- :return: None if not overriden. Else return the ExtraNodeLabels specified on the node.
103
+ :return: None if not overridden. Else return the ExtraNodeLabels specified on the node.
104
104
  """
105
105
  return None
106
+
107
+ @property
108
+ def scoped_cleanup(self) -> bool:
109
+ """
110
+ Optional.
111
+ Allows specifying whether cleanups of this node must be scoped to the sub resource relationship.
112
+ If True (default), when we clean up nodes of this type, we will only delete stale nodes in the current sub
113
+ resource. This is how our AWS sync behaves.
114
+ If False, when we clean up node of this type, we will delete all stale nodes. This is designed for resource
115
+ types that don't have a "tenant"-like entity.
116
+ :return: True if not overridden. Else return the boolean value specified on the node.
117
+ """
118
+ return True
File without changes
@@ -0,0 +1,90 @@
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 OpenAIAdminApiKeyNodeProperties(CartographyNodeProperties):
16
+ object: PropertyRef = PropertyRef("object")
17
+ id: PropertyRef = PropertyRef("id")
18
+ name: PropertyRef = PropertyRef("name")
19
+ created_at: PropertyRef = PropertyRef("created_at")
20
+ last_used_at: PropertyRef = PropertyRef("last_used_at")
21
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class OpenAIAdminApiKeyToOrganizationRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ # (:OpenAIOrganization)-[:RESOURCE]->(:OpenAIAdminApiKey)
31
+ class OpenAIAdminApiKeyToOrganizationRel(CartographyRelSchema):
32
+ target_node_label: str = "OpenAIOrganization"
33
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
34
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
35
+ )
36
+ direction: LinkDirection = LinkDirection.INWARD
37
+ rel_label: str = "RESOURCE"
38
+ properties: OpenAIAdminApiKeyToOrganizationRelProperties = (
39
+ OpenAIAdminApiKeyToOrganizationRelProperties()
40
+ )
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class OpenAIAdminApiKeyToUserRelProperties(CartographyRelProperties):
45
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ # (:OpenAIUser)-[:OWNS]->(:OpenAIAdminApiKey)
50
+ class OpenAIAdminApiKeyToUserRel(CartographyRelSchema):
51
+ target_node_label: str = "OpenAIUser"
52
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
53
+ {"id": PropertyRef("owner_user_id")},
54
+ )
55
+ direction: LinkDirection = LinkDirection.INWARD
56
+ rel_label: str = "OWNS"
57
+ properties: OpenAIAdminApiKeyToUserRelProperties = (
58
+ OpenAIAdminApiKeyToUserRelProperties()
59
+ )
60
+
61
+
62
+ @dataclass(frozen=True)
63
+ class OpenAIAdminApiKeyToSARelProperties(CartographyRelProperties):
64
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ # (:OpenAIServiceAccount)-[:OWNS]->(:OpenAIAdminApiKey)
69
+ class OpenAIAdminApiKeyToSARel(CartographyRelSchema):
70
+ target_node_label: str = "OpenAIServiceAccount"
71
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
72
+ {"id": PropertyRef("owner_sa_id")},
73
+ )
74
+ direction: LinkDirection = LinkDirection.INWARD
75
+ rel_label: str = "OWNS"
76
+ properties: OpenAIAdminApiKeyToSARelProperties = (
77
+ OpenAIAdminApiKeyToSARelProperties()
78
+ )
79
+
80
+
81
+ @dataclass(frozen=True)
82
+ class OpenAIAdminApiKeySchema(CartographyNodeSchema):
83
+ label: str = "OpenAIAdminApiKey"
84
+ properties: OpenAIAdminApiKeyNodeProperties = OpenAIAdminApiKeyNodeProperties()
85
+ sub_resource_relationship: OpenAIAdminApiKeyToOrganizationRel = (
86
+ OpenAIAdminApiKeyToOrganizationRel()
87
+ )
88
+ other_relationships: OtherRelationships = OtherRelationships(
89
+ [OpenAIAdminApiKeyToUserRel(), OpenAIAdminApiKeyToSARel()],
90
+ )
@@ -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 OpenAIApiKeyNodeProperties(CartographyNodeProperties):
16
+ object: PropertyRef = PropertyRef("object")
17
+ name: PropertyRef = PropertyRef("name")
18
+ created_at: PropertyRef = PropertyRef("created_at")
19
+ last_used_at: PropertyRef = PropertyRef("last_used_at")
20
+ id: PropertyRef = PropertyRef("id")
21
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class OpenAIApiKeyToProjectRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ # (:OpenAIApiKey)<-[:RESOURCE]-(:OpenAIProject)
31
+ class OpenAIApiKeyToProjectRel(CartographyRelSchema):
32
+ target_node_label: str = "OpenAIProject"
33
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
34
+ {"id": PropertyRef("project_id", set_in_kwargs=True)},
35
+ )
36
+ direction: LinkDirection = LinkDirection.INWARD
37
+ rel_label: str = "RESOURCE"
38
+ properties: OpenAIApiKeyToProjectRelProperties = (
39
+ OpenAIApiKeyToProjectRelProperties()
40
+ )
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class OpenAIApiKeyToUserRelProperties(CartographyRelProperties):
45
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ # (:OpenAIUser)-[:OWNS]->(:OpenAIApiKey)
50
+ class OpenAIApiKeyToUserRel(CartographyRelSchema):
51
+ target_node_label: str = "OpenAIUser"
52
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
53
+ {"id": PropertyRef("owner_user_id")},
54
+ )
55
+ direction: LinkDirection = LinkDirection.INWARD
56
+ rel_label: str = "OWNS"
57
+ properties: OpenAIApiKeyToUserRelProperties = OpenAIApiKeyToUserRelProperties()
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class OpenAIApiKeyToSARelProperties(CartographyRelProperties):
62
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
63
+
64
+
65
+ @dataclass(frozen=True)
66
+ # (:OpenAIServiceAccount)-[:OWNS]->(:OpenAIApiKey)
67
+ class OpenAIApiKeyToSARel(CartographyRelSchema):
68
+ target_node_label: str = "OpenAIServiceAccount"
69
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
70
+ {"id": PropertyRef("owner_sa_id")},
71
+ )
72
+ direction: LinkDirection = LinkDirection.INWARD
73
+ rel_label: str = "OWNS"
74
+ properties: OpenAIApiKeyToSARelProperties = OpenAIApiKeyToSARelProperties()
75
+
76
+
77
+ @dataclass(frozen=True)
78
+ class OpenAIApiKeySchema(CartographyNodeSchema):
79
+ label: str = "OpenAIApiKey"
80
+ properties: OpenAIApiKeyNodeProperties = OpenAIApiKeyNodeProperties()
81
+ sub_resource_relationship: OpenAIApiKeyToProjectRel = OpenAIApiKeyToProjectRel()
82
+ other_relationships: OtherRelationships = OtherRelationships(
83
+ [OpenAIApiKeyToUserRel(), OpenAIApiKeyToSARel()],
84
+ )
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class OpenAIOrganizationNodeProperties(CartographyNodeProperties):
10
+ id: PropertyRef = PropertyRef("id")
11
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class OpenAIOrganizationSchema(CartographyNodeSchema):
16
+ label: str = "OpenAIOrganization"
17
+ properties: OpenAIOrganizationNodeProperties = OpenAIOrganizationNodeProperties()
@@ -0,0 +1,89 @@
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 OpenAIProjectNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ object: PropertyRef = PropertyRef("object")
18
+ name: PropertyRef = PropertyRef("name")
19
+ created_at: PropertyRef = PropertyRef("created_at")
20
+ archived_at: PropertyRef = PropertyRef("archived_at")
21
+ status: PropertyRef = PropertyRef("status")
22
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class OpenAIProjectToOrganizationRelProperties(CartographyRelProperties):
27
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ # (:OpenAIOrganization)-[:RESOURCE]->(:OpenAIProject)
32
+ class OpenAIProjectToOrganizationRel(CartographyRelSchema):
33
+ target_node_label: str = "OpenAIOrganization"
34
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
35
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
36
+ )
37
+ direction: LinkDirection = LinkDirection.INWARD
38
+ rel_label: str = "RESOURCE"
39
+ properties: OpenAIProjectToOrganizationRelProperties = (
40
+ OpenAIProjectToOrganizationRelProperties()
41
+ )
42
+
43
+
44
+ @dataclass(frozen=True)
45
+ class OpenAIProjectToUserRelProperties(CartographyRelProperties):
46
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ # (:OpenAIUser)-[:MEMBER_OF]->(:OpenAIProject)
51
+ class OpenAIProjectToUserRel(CartographyRelSchema):
52
+ target_node_label: str = "OpenAIUser"
53
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
54
+ {"id": PropertyRef("users", one_to_many=True)},
55
+ )
56
+ direction: LinkDirection = LinkDirection.INWARD
57
+ rel_label: str = "MEMBER_OF"
58
+ properties: OpenAIProjectToUserRelProperties = OpenAIProjectToUserRelProperties()
59
+
60
+
61
+ @dataclass(frozen=True)
62
+ class OpenAIProjectToUserAdminRelProperties(CartographyRelProperties):
63
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ # (:OpenAIUser)-[:ADMIN_OF]->(:OpenAIProject)
68
+ class OpenAIProjectToUserAdminRel(CartographyRelSchema):
69
+ target_node_label: str = "OpenAIUser"
70
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
71
+ {"id": PropertyRef("admins", one_to_many=True)},
72
+ )
73
+ direction: LinkDirection = LinkDirection.INWARD
74
+ rel_label: str = "ADMIN_OF"
75
+ properties: OpenAIProjectToUserAdminRelProperties = (
76
+ OpenAIProjectToUserAdminRelProperties()
77
+ )
78
+
79
+
80
+ @dataclass(frozen=True)
81
+ class OpenAIProjectSchema(CartographyNodeSchema):
82
+ label: str = "OpenAIProject"
83
+ properties: OpenAIProjectNodeProperties = OpenAIProjectNodeProperties()
84
+ sub_resource_relationship: OpenAIProjectToOrganizationRel = (
85
+ OpenAIProjectToOrganizationRel()
86
+ )
87
+ other_relationships: OtherRelationships = OtherRelationships(
88
+ [OpenAIProjectToUserRel(), OpenAIProjectToUserAdminRel()],
89
+ )