cartography 0.106.0rc1__py3-none-any.whl → 0.107.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 (88) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +131 -2
  3. cartography/client/core/tx.py +62 -0
  4. cartography/config.py +42 -0
  5. cartography/driftdetect/cli.py +3 -2
  6. cartography/graph/cleanupbuilder.py +47 -0
  7. cartography/graph/job.py +42 -0
  8. cartography/graph/querybuilder.py +136 -2
  9. cartography/graph/statement.py +1 -1
  10. cartography/intel/airbyte/__init__.py +105 -0
  11. cartography/intel/airbyte/connections.py +120 -0
  12. cartography/intel/airbyte/destinations.py +81 -0
  13. cartography/intel/airbyte/organizations.py +59 -0
  14. cartography/intel/airbyte/sources.py +78 -0
  15. cartography/intel/airbyte/tags.py +64 -0
  16. cartography/intel/airbyte/users.py +106 -0
  17. cartography/intel/airbyte/util.py +122 -0
  18. cartography/intel/airbyte/workspaces.py +63 -0
  19. cartography/intel/aws/__init__.py +1 -0
  20. cartography/intel/aws/cloudtrail_management_events.py +364 -0
  21. cartography/intel/aws/codebuild.py +132 -0
  22. cartography/intel/aws/efs.py +80 -0
  23. cartography/intel/aws/inspector.py +3 -13
  24. cartography/intel/aws/resources.py +4 -0
  25. cartography/intel/aws/sns.py +62 -2
  26. cartography/intel/entra/users.py +84 -42
  27. cartography/intel/scaleway/__init__.py +127 -0
  28. cartography/intel/scaleway/iam/__init__.py +0 -0
  29. cartography/intel/scaleway/iam/apikeys.py +71 -0
  30. cartography/intel/scaleway/iam/applications.py +71 -0
  31. cartography/intel/scaleway/iam/groups.py +71 -0
  32. cartography/intel/scaleway/iam/users.py +71 -0
  33. cartography/intel/scaleway/instances/__init__.py +0 -0
  34. cartography/intel/scaleway/instances/flexibleips.py +86 -0
  35. cartography/intel/scaleway/instances/instances.py +92 -0
  36. cartography/intel/scaleway/projects.py +79 -0
  37. cartography/intel/scaleway/storage/__init__.py +0 -0
  38. cartography/intel/scaleway/storage/snapshots.py +86 -0
  39. cartography/intel/scaleway/storage/volumes.py +84 -0
  40. cartography/intel/scaleway/utils.py +37 -0
  41. cartography/intel/sentinelone/__init__.py +63 -0
  42. cartography/intel/sentinelone/account.py +140 -0
  43. cartography/intel/sentinelone/agent.py +139 -0
  44. cartography/intel/sentinelone/api.py +113 -0
  45. cartography/intel/sentinelone/utils.py +9 -0
  46. cartography/models/airbyte/__init__.py +0 -0
  47. cartography/models/airbyte/connection.py +138 -0
  48. cartography/models/airbyte/destination.py +75 -0
  49. cartography/models/airbyte/organization.py +19 -0
  50. cartography/models/airbyte/source.py +75 -0
  51. cartography/models/airbyte/stream.py +74 -0
  52. cartography/models/airbyte/tag.py +69 -0
  53. cartography/models/airbyte/user.py +111 -0
  54. cartography/models/airbyte/workspace.py +46 -0
  55. cartography/models/aws/cloudtrail/management_events.py +64 -0
  56. cartography/models/aws/codebuild/__init__.py +0 -0
  57. cartography/models/aws/codebuild/project.py +49 -0
  58. cartography/models/aws/ecs/containers.py +19 -0
  59. cartography/models/aws/ecs/task_definitions.py +38 -0
  60. cartography/models/aws/efs/access_point.py +77 -0
  61. cartography/models/aws/sns/topic_subscription.py +74 -0
  62. cartography/models/core/common.py +1 -0
  63. cartography/models/core/relationships.py +44 -0
  64. cartography/models/entra/user.py +17 -51
  65. cartography/models/scaleway/__init__.py +0 -0
  66. cartography/models/scaleway/iam/__init__.py +0 -0
  67. cartography/models/scaleway/iam/apikey.py +96 -0
  68. cartography/models/scaleway/iam/application.py +52 -0
  69. cartography/models/scaleway/iam/group.py +95 -0
  70. cartography/models/scaleway/iam/user.py +60 -0
  71. cartography/models/scaleway/instance/__init__.py +0 -0
  72. cartography/models/scaleway/instance/flexibleip.py +52 -0
  73. cartography/models/scaleway/instance/instance.py +118 -0
  74. cartography/models/scaleway/organization.py +19 -0
  75. cartography/models/scaleway/project.py +48 -0
  76. cartography/models/scaleway/storage/__init__.py +0 -0
  77. cartography/models/scaleway/storage/snapshot.py +78 -0
  78. cartography/models/scaleway/storage/volume.py +51 -0
  79. cartography/models/sentinelone/__init__.py +1 -0
  80. cartography/models/sentinelone/account.py +40 -0
  81. cartography/models/sentinelone/agent.py +50 -0
  82. cartography/sync.py +11 -4
  83. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/METADATA +20 -16
  84. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/RECORD +88 -27
  85. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/WHEEL +0 -0
  86. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/entry_points.txt +0 -0
  87. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/licenses/LICENSE +0 -0
  88. {cartography-0.106.0rc1.dist-info → cartography-0.107.0rc1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,74 @@
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 SNSTopicSubscriptionNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("SubscriptionArn")
17
+ arn: PropertyRef = PropertyRef("SubscriptionArn", extra_index=True)
18
+ topic_arn: PropertyRef = PropertyRef("TopicArn")
19
+ endpoint: PropertyRef = PropertyRef("Endpoint")
20
+ owner: PropertyRef = PropertyRef("Owner")
21
+ protocol: PropertyRef = PropertyRef("Protocol")
22
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class SNSTopicSubscriptionToAwsAccountRelProperties(CartographyRelProperties):
27
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class SNSTopicSubscriptionToAWSAccountRel(CartographyRelSchema):
32
+ target_node_label: str = "AWSAccount"
33
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
34
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
35
+ )
36
+ direction: LinkDirection = LinkDirection.INWARD
37
+ rel_label: str = "RESOURCE"
38
+ properties: SNSTopicSubscriptionToAwsAccountRelProperties = (
39
+ SNSTopicSubscriptionToAwsAccountRelProperties()
40
+ )
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class SNSTopicSubscriptionToSNSTopicRelProperties(CartographyRelProperties):
45
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class SNSTopicSubscriptionToSNSTopicRel(CartographyRelSchema):
50
+ target_node_label: str = "SNSTopic"
51
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
52
+ {"id": PropertyRef("TopicArn")},
53
+ )
54
+ direction: LinkDirection = LinkDirection.OUTWARD
55
+ rel_label: str = "HAS_SUBSCRIPTION"
56
+ properties: SNSTopicSubscriptionToSNSTopicRelProperties = (
57
+ SNSTopicSubscriptionToSNSTopicRelProperties()
58
+ )
59
+
60
+
61
+ @dataclass(frozen=True)
62
+ class SNSTopicSubscriptionSchema(CartographyNodeSchema):
63
+ label: str = "SNSTopicSubscription"
64
+ properties: SNSTopicSubscriptionNodeProperties = (
65
+ SNSTopicSubscriptionNodeProperties()
66
+ )
67
+ sub_resource_relationship: SNSTopicSubscriptionToAWSAccountRel = (
68
+ SNSTopicSubscriptionToAWSAccountRel()
69
+ )
70
+ other_relationships: OtherRelationships = OtherRelationships(
71
+ [
72
+ SNSTopicSubscriptionToSNSTopicRel(),
73
+ ]
74
+ )
@@ -63,6 +63,7 @@ class PropertyRef:
63
63
  ```
64
64
  This means that as we create AWSInstanceProfile nodes, we will search for AWSRoles to attach to, and we do
65
65
  this by checking if each role's `arn` field is in the `Roles` list of the data dict.
66
+ Note that one_to_many has no effect on matchlinks.
66
67
  """
67
68
  self.name = name
68
69
  self.set_in_kwargs = set_in_kwargs
@@ -42,6 +42,11 @@ class CartographyRelProperties(abc.ABC):
42
42
  Abstract class that represents the properties on a CartographyRelSchema. This is intended to enforce that all
43
43
  subclasses will have a lastupdated field defined on their resulting relationships. These fields are assigned to the
44
44
  relationship in the `SET` clause.
45
+
46
+ If the CartographyRelSchema is used as a MatchLink, the following properties are required to be defined here:
47
+ - lastupdated: A PropertyRef to the update tag of the relationship.
48
+ - _sub_resource_label: A PropertyRef to the label of the sub-resource that the relationship is associated with.
49
+ - _sub_resource_id: A PropertyRef to the id of the sub-resource that the relationship is associated with.
45
50
  """
46
51
 
47
52
  lastupdated: PropertyRef = field(init=False)
@@ -90,6 +95,29 @@ def make_target_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> TargetNode
90
95
  return make_dataclass(TargetNodeMatcher.__name__, fields, frozen=True)()
91
96
 
92
97
 
98
+ @dataclass(frozen=True)
99
+ class SourceNodeMatcher:
100
+ """
101
+ Same as TargetNodeMatcher, but for the source node; see `make_source_node_matcher()`.
102
+ This object is used only for load_matchlinks() where we match on and connect existing nodes.
103
+ This has no effect on CartographyRelSchema objects that are included in CartographyNodeSchema.
104
+ """
105
+
106
+ pass
107
+
108
+
109
+ def make_source_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> SourceNodeMatcher:
110
+ """
111
+ :param key_ref_dict: A Dict mapping keys present on the node to PropertyRef objects.
112
+ :return: A SourceNodeMatcher used for CartographyRelSchema to match with other nodes.
113
+ """
114
+ fields = [
115
+ (key, PropertyRef, field(default=prop_ref))
116
+ for key, prop_ref in key_ref_dict.items()
117
+ ]
118
+ return make_dataclass(SourceNodeMatcher.__name__, fields, frozen=True)()
119
+
120
+
93
121
  @dataclass(frozen=True)
94
122
  class CartographyRelSchema(abc.ABC):
95
123
  """
@@ -139,6 +167,22 @@ class CartographyRelSchema(abc.ABC):
139
167
  """
140
168
  pass
141
169
 
170
+ @property
171
+ def source_node_label(self) -> str | None:
172
+ """
173
+ :return: Optional. Only used for load_matchlinks(). The source node label to use for the relationship.
174
+ This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
175
+ """
176
+ return None
177
+
178
+ @property
179
+ def source_node_matcher(self) -> SourceNodeMatcher | None:
180
+ """
181
+ :return: Optional. Only used for load_matchlinks(). A SourceNodeMatcher object used to find what node(s) to attach the relationship to.
182
+ This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
183
+ """
184
+ return None
185
+
142
186
 
143
187
  @dataclass(frozen=True)
144
188
  class OtherRelationships:
@@ -9,6 +9,10 @@ from cartography.models.core.relationships import LinkDirection
9
9
  from cartography.models.core.relationships import make_target_node_matcher
10
10
  from cartography.models.core.relationships import TargetNodeMatcher
11
11
 
12
+ # The user resource in Microsoft Graph exposes hundreds of properties but, in
13
+ # practice, only a small subset is populated in most tenants. We deliberately
14
+ # model *just* the commonly-used attributes to keep the graph lean.
15
+
12
16
 
13
17
  @dataclass(frozen=True)
14
18
  class EntraUserNodeProperties(CartographyNodeProperties):
@@ -17,61 +21,23 @@ class EntraUserNodeProperties(CartographyNodeProperties):
17
21
  display_name: PropertyRef = PropertyRef("display_name")
18
22
  given_name: PropertyRef = PropertyRef("given_name")
19
23
  surname: PropertyRef = PropertyRef("surname")
20
- # The underlying datatype calls this 'mail' but everything else in cartography uses 'email'
24
+ # The SDK calls this `mail`; we surface it as `email` like the rest of Cartography
21
25
  email: PropertyRef = PropertyRef("mail", extra_index=True)
22
- other_mails: PropertyRef = PropertyRef("other_mails")
23
- preferred_language: PropertyRef = PropertyRef("preferred_language")
24
- preferred_name: PropertyRef = PropertyRef("preferred_name")
25
- state: PropertyRef = PropertyRef("state")
26
- usage_location: PropertyRef = PropertyRef("usage_location")
27
- user_type: PropertyRef = PropertyRef("user_type")
28
- show_in_address_list: PropertyRef = PropertyRef("show_in_address_list")
29
- sign_in_sessions_valid_from_date_time: PropertyRef = PropertyRef(
30
- "sign_in_sessions_valid_from_date_time"
31
- )
32
- security_identifier: PropertyRef = PropertyRef("security_identifier")
33
- account_enabled: PropertyRef = PropertyRef("account_enabled")
34
- city: PropertyRef = PropertyRef("city")
35
- company_name: PropertyRef = PropertyRef("company_name")
36
- consent_provided_for_minor: PropertyRef = PropertyRef("consent_provided_for_minor")
37
- country: PropertyRef = PropertyRef("country")
38
- created_date_time: PropertyRef = PropertyRef("created_date_time")
39
- creation_type: PropertyRef = PropertyRef("creation_type")
40
- deleted_date_time: PropertyRef = PropertyRef("deleted_date_time")
26
+ mobile_phone: PropertyRef = PropertyRef("mobile_phone")
27
+ business_phones: PropertyRef = PropertyRef("business_phones")
28
+ job_title: PropertyRef = PropertyRef("job_title")
41
29
  department: PropertyRef = PropertyRef("department")
30
+ company_name: PropertyRef = PropertyRef("company_name")
31
+ office_location: PropertyRef = PropertyRef("office_location")
42
32
  employee_id: PropertyRef = PropertyRef("employee_id")
43
33
  employee_type: PropertyRef = PropertyRef("employee_type")
44
- external_user_state: PropertyRef = PropertyRef("external_user_state")
45
- external_user_state_change_date_time: PropertyRef = PropertyRef(
46
- "external_user_state_change_date_time"
47
- )
48
- hire_date: PropertyRef = PropertyRef("hire_date")
49
- is_management_restricted: PropertyRef = PropertyRef("is_management_restricted")
50
- is_resource_account: PropertyRef = PropertyRef("is_resource_account")
51
- job_title: PropertyRef = PropertyRef("job_title")
52
- last_password_change_date_time: PropertyRef = PropertyRef(
53
- "last_password_change_date_time"
54
- )
55
- mail_nickname: PropertyRef = PropertyRef("mail_nickname")
56
- office_location: PropertyRef = PropertyRef("office_location")
57
- on_premises_distinguished_name: PropertyRef = PropertyRef(
58
- "on_premises_distinguished_name"
59
- )
60
- on_premises_domain_name: PropertyRef = PropertyRef("on_premises_domain_name")
61
- on_premises_immutable_id: PropertyRef = PropertyRef("on_premises_immutable_id")
62
- on_premises_last_sync_date_time: PropertyRef = PropertyRef(
63
- "on_premises_last_sync_date_time"
64
- )
65
- on_premises_sam_account_name: PropertyRef = PropertyRef(
66
- "on_premises_sam_account_name"
67
- )
68
- on_premises_security_identifier: PropertyRef = PropertyRef(
69
- "on_premises_security_identifier"
70
- )
71
- on_premises_sync_enabled: PropertyRef = PropertyRef("on_premises_sync_enabled")
72
- on_premises_user_principal_name: PropertyRef = PropertyRef(
73
- "on_premises_user_principal_name"
74
- )
34
+ city: PropertyRef = PropertyRef("city")
35
+ state: PropertyRef = PropertyRef("state")
36
+ country: PropertyRef = PropertyRef("country")
37
+ preferred_language: PropertyRef = PropertyRef("preferred_language")
38
+ account_enabled: PropertyRef = PropertyRef("account_enabled")
39
+ age_group: PropertyRef = PropertyRef("age_group")
40
+ manager_id: PropertyRef = PropertyRef("manager_id")
75
41
  lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
76
42
 
77
43
 
File without changes
File without changes
@@ -0,0 +1,96 @@
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 ScalewayApiKeyProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("access_key")
17
+ description: PropertyRef = PropertyRef("description")
18
+ created_at: PropertyRef = PropertyRef("created_at")
19
+ updated_at: PropertyRef = PropertyRef("updated_at")
20
+ expires_at: PropertyRef = PropertyRef("expires_at")
21
+ default_project_id: PropertyRef = PropertyRef("default_project_id")
22
+ editable: PropertyRef = PropertyRef("editable")
23
+ deletable: PropertyRef = PropertyRef("deletable")
24
+ managed: PropertyRef = PropertyRef("managed")
25
+ creation_ip: PropertyRef = PropertyRef("creation_ip")
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class ScalewayApiKeyToUserProperties(CartographyRelProperties):
31
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ # (:ScalewayUser)-[:HAS]->(:ScalewayApiKey)
36
+ class ScalewayApiKeyToUserRel(CartographyRelSchema):
37
+ target_node_label: str = "ScalewayUser"
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {"id": PropertyRef("user_id")},
40
+ )
41
+ direction: LinkDirection = LinkDirection.INWARD
42
+ rel_label: str = "HAS"
43
+ properties: ScalewayApiKeyToUserProperties = ScalewayApiKeyToUserProperties()
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class ScalewayApiKeyToApplicationProperties(CartographyRelProperties):
48
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
49
+
50
+
51
+ @dataclass(frozen=True)
52
+ # (:ScalewayApplication)-[:HAS]->(:ScalewayApiKey)
53
+ class ScalewayApiKeyToApplicationRel(CartographyRelSchema):
54
+ target_node_label: str = "ScalewayApplication"
55
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
56
+ {"id": PropertyRef("application_id")},
57
+ )
58
+ direction: LinkDirection = LinkDirection.INWARD
59
+ rel_label: str = "HAS"
60
+ properties: ScalewayApiKeyToApplicationProperties = (
61
+ ScalewayApiKeyToApplicationProperties()
62
+ )
63
+
64
+
65
+ @dataclass(frozen=True)
66
+ class ScalewayApiKeyToOrganizationRelProperties(CartographyRelProperties):
67
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
68
+
69
+
70
+ @dataclass(frozen=True)
71
+ # (:ScalewayOrganization)-[:RESOURCE]->(:ScalewayApiKey)
72
+ class ScalewayApiKeyToOrganizationRel(CartographyRelSchema):
73
+ target_node_label: str = "ScalewayOrganization"
74
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
75
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
76
+ )
77
+ direction: LinkDirection = LinkDirection.INWARD
78
+ rel_label: str = "RESOURCE"
79
+ properties: ScalewayApiKeyToOrganizationRelProperties = (
80
+ ScalewayApiKeyToOrganizationRelProperties()
81
+ )
82
+
83
+
84
+ @dataclass(frozen=True)
85
+ class ScalewayApiKeySchema(CartographyNodeSchema):
86
+ label: str = "ScalewayApiKey"
87
+ properties: ScalewayApiKeyProperties = ScalewayApiKeyProperties()
88
+ sub_resource_relationship: ScalewayApiKeyToOrganizationRel = (
89
+ ScalewayApiKeyToOrganizationRel()
90
+ )
91
+ other_relationships: OtherRelationships = OtherRelationships(
92
+ [
93
+ ScalewayApiKeyToUserRel(),
94
+ ScalewayApiKeyToApplicationRel(),
95
+ ]
96
+ )
@@ -0,0 +1,52 @@
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 ScalewayApplicationNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("id")
16
+ name: PropertyRef = PropertyRef("name")
17
+ description: PropertyRef = PropertyRef("description")
18
+ created_at: PropertyRef = PropertyRef("created_at")
19
+ updated_at: PropertyRef = PropertyRef("updated_at")
20
+ editable: PropertyRef = PropertyRef("editable")
21
+ deletable: PropertyRef = PropertyRef("deletable")
22
+ managed: PropertyRef = PropertyRef("managed")
23
+ tags: PropertyRef = PropertyRef("tags")
24
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class ScalewayApplicationToOrganizationRelProperties(CartographyRelProperties):
29
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ # (:ScalewayOrganization)-[:RESOURCE]->(:ScalewayApplication)
34
+ class ScalewayApplicationToOrganizationRel(CartographyRelSchema):
35
+ target_node_label: str = "ScalewayOrganization"
36
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
37
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
38
+ )
39
+ direction: LinkDirection = LinkDirection.INWARD
40
+ rel_label: str = "RESOURCE"
41
+ properties: ScalewayApplicationToOrganizationRelProperties = (
42
+ ScalewayApplicationToOrganizationRelProperties()
43
+ )
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class ScalewayApplicationSchema(CartographyNodeSchema):
48
+ label: str = "ScalewayApplication"
49
+ properties: ScalewayApplicationNodeProperties = ScalewayApplicationNodeProperties()
50
+ sub_resource_relationship: ScalewayApplicationToOrganizationRel = (
51
+ ScalewayApplicationToOrganizationRel()
52
+ )
@@ -0,0 +1,95 @@
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 ScalewayGroupProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ created_at: PropertyRef = PropertyRef("created_at")
18
+ updated_at: PropertyRef = PropertyRef("updated_at")
19
+ name: PropertyRef = PropertyRef("name")
20
+ description: PropertyRef = PropertyRef("description")
21
+ tags: PropertyRef = PropertyRef("tags", extra_index=True)
22
+ editable: PropertyRef = PropertyRef("editable")
23
+ deletable: PropertyRef = PropertyRef("deletable")
24
+ managed: PropertyRef = PropertyRef("managed")
25
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class ScalewayGroupToUserProperties(CartographyRelProperties):
30
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
31
+
32
+
33
+ @dataclass(frozen=True)
34
+ # (:ScalewayUser)-[:MEMBER_OF]->(:ScalewayGroup)
35
+ class ScalewayGroupToUserRel(CartographyRelSchema):
36
+ target_node_label: str = "ScalewayUser"
37
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
38
+ {"id": PropertyRef("user_ids", one_to_many=True)},
39
+ )
40
+ direction: LinkDirection = LinkDirection.INWARD
41
+ rel_label: str = "MEMBER_OF"
42
+ properties: ScalewayGroupToUserProperties = ScalewayGroupToUserProperties()
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class ScalewayGroupToApplicationProperties(CartographyRelProperties):
47
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
48
+
49
+
50
+ @dataclass(frozen=True)
51
+ # (:ScalewayApplication)-[:MEMBER_OF]->(:ScalewayGroup)
52
+ class ScalewayGroupToApplicationRel(CartographyRelSchema):
53
+ target_node_label: str = "ScalewayApplication"
54
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
55
+ {"id": PropertyRef("application_ids", one_to_many=True)},
56
+ )
57
+ direction: LinkDirection = LinkDirection.INWARD
58
+ rel_label: str = "MEMBER_OF"
59
+ properties: ScalewayGroupToApplicationProperties = (
60
+ ScalewayGroupToApplicationProperties()
61
+ )
62
+
63
+
64
+ @dataclass(frozen=True)
65
+ class ScalewayGroupToOrganizationRelProperties(CartographyRelProperties):
66
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
67
+
68
+
69
+ @dataclass(frozen=True)
70
+ # (:ScalewayOrganization)-[:RESOURCE]->(:ScalewayGroup)
71
+ class ScalewayGroupToOrganizationRel(CartographyRelSchema):
72
+ target_node_label: str = "ScalewayOrganization"
73
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
74
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
75
+ )
76
+ direction: LinkDirection = LinkDirection.INWARD
77
+ rel_label: str = "RESOURCE"
78
+ properties: ScalewayGroupToOrganizationRelProperties = (
79
+ ScalewayGroupToOrganizationRelProperties()
80
+ )
81
+
82
+
83
+ @dataclass(frozen=True)
84
+ class ScalewayGroupSchema(CartographyNodeSchema):
85
+ label: str = "ScalewayGroup"
86
+ properties: ScalewayGroupProperties = ScalewayGroupProperties()
87
+ sub_resource_relationship: ScalewayGroupToOrganizationRel = (
88
+ ScalewayGroupToOrganizationRel()
89
+ )
90
+ other_relationships: OtherRelationships = OtherRelationships(
91
+ [
92
+ ScalewayGroupToUserRel(),
93
+ ScalewayGroupToApplicationRel(),
94
+ ]
95
+ )
@@ -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 ScalewayUserNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("id")
16
+ email: PropertyRef = PropertyRef("email", extra_index=True)
17
+ username: PropertyRef = PropertyRef("username")
18
+ first_name: PropertyRef = PropertyRef("first_name")
19
+ last_name: PropertyRef = PropertyRef("last_name")
20
+ phone_number: PropertyRef = PropertyRef("phone_number")
21
+ locale: PropertyRef = PropertyRef("locale")
22
+ created_at: PropertyRef = PropertyRef("created_at")
23
+ updated_at: PropertyRef = PropertyRef("updated_at")
24
+ deletable: PropertyRef = PropertyRef("deletable")
25
+ last_login_at: PropertyRef = PropertyRef("last_login_at")
26
+ type: PropertyRef = PropertyRef("type")
27
+ status: PropertyRef = PropertyRef("status")
28
+ mfa: PropertyRef = PropertyRef("mfa")
29
+ account_root_user_id: PropertyRef = PropertyRef("account_root_user_id")
30
+ tags: PropertyRef = PropertyRef("tags")
31
+ locked: PropertyRef = PropertyRef("locked")
32
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class ScalewayUserToOrganizationRelProperties(CartographyRelProperties):
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ # (:ScalewayOrganization)-[:RESOURCE]->(:ScalewayUser)
42
+ class ScalewayUserToOrganizationRel(CartographyRelSchema):
43
+ target_node_label: str = "ScalewayOrganization"
44
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
45
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
46
+ )
47
+ direction: LinkDirection = LinkDirection.INWARD
48
+ rel_label: str = "RESOURCE"
49
+ properties: ScalewayUserToOrganizationRelProperties = (
50
+ ScalewayUserToOrganizationRelProperties()
51
+ )
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class ScalewayUserSchema(CartographyNodeSchema):
56
+ label: str = "ScalewayUser"
57
+ properties: ScalewayUserNodeProperties = ScalewayUserNodeProperties()
58
+ sub_resource_relationship: ScalewayUserToOrganizationRel = (
59
+ ScalewayUserToOrganizationRel()
60
+ )
File without changes
@@ -0,0 +1,52 @@
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 ScalewayFlexibleIpProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("id")
16
+ address: PropertyRef = PropertyRef("address")
17
+ reverse: PropertyRef = PropertyRef("reverse")
18
+ tags: PropertyRef = PropertyRef("tags")
19
+ type: PropertyRef = PropertyRef("type")
20
+ state: PropertyRef = PropertyRef("state")
21
+ prefix: PropertyRef = PropertyRef("prefix")
22
+ ipam_id: PropertyRef = PropertyRef("ipam_id")
23
+ zone: PropertyRef = PropertyRef("zone")
24
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class ScalewayFlexibleIpToProjectRelProperties(CartographyRelProperties):
29
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ # (:ScalewayProject)-[:RESOURCE]->(:ScalewayFlexibleIp)
34
+ class ScalewayFlexibleIpToProjectRel(CartographyRelSchema):
35
+ target_node_label: str = "ScalewayProject"
36
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
37
+ {"id": PropertyRef("PROJECT_ID", set_in_kwargs=True)},
38
+ )
39
+ direction: LinkDirection = LinkDirection.INWARD
40
+ rel_label: str = "RESOURCE"
41
+ properties: ScalewayFlexibleIpToProjectRelProperties = (
42
+ ScalewayFlexibleIpToProjectRelProperties()
43
+ )
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class ScalewayFlexibleIpSchema(CartographyNodeSchema):
48
+ label: str = "ScalewayFlexibleIp"
49
+ properties: ScalewayFlexibleIpProperties = ScalewayFlexibleIpProperties()
50
+ sub_resource_relationship: ScalewayFlexibleIpToProjectRel = (
51
+ ScalewayFlexibleIpToProjectRel()
52
+ )