cartography 0.106.0rc2__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 (78) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +131 -2
  3. cartography/config.py +42 -0
  4. cartography/driftdetect/cli.py +3 -2
  5. cartography/intel/airbyte/__init__.py +105 -0
  6. cartography/intel/airbyte/connections.py +120 -0
  7. cartography/intel/airbyte/destinations.py +81 -0
  8. cartography/intel/airbyte/organizations.py +59 -0
  9. cartography/intel/airbyte/sources.py +78 -0
  10. cartography/intel/airbyte/tags.py +64 -0
  11. cartography/intel/airbyte/users.py +106 -0
  12. cartography/intel/airbyte/util.py +122 -0
  13. cartography/intel/airbyte/workspaces.py +63 -0
  14. cartography/intel/aws/__init__.py +1 -0
  15. cartography/intel/aws/cloudtrail_management_events.py +364 -0
  16. cartography/intel/aws/codebuild.py +132 -0
  17. cartography/intel/aws/resources.py +4 -0
  18. cartography/intel/aws/sns.py +62 -2
  19. cartography/intel/entra/users.py +84 -42
  20. cartography/intel/scaleway/__init__.py +127 -0
  21. cartography/intel/scaleway/iam/__init__.py +0 -0
  22. cartography/intel/scaleway/iam/apikeys.py +71 -0
  23. cartography/intel/scaleway/iam/applications.py +71 -0
  24. cartography/intel/scaleway/iam/groups.py +71 -0
  25. cartography/intel/scaleway/iam/users.py +71 -0
  26. cartography/intel/scaleway/instances/__init__.py +0 -0
  27. cartography/intel/scaleway/instances/flexibleips.py +86 -0
  28. cartography/intel/scaleway/instances/instances.py +92 -0
  29. cartography/intel/scaleway/projects.py +79 -0
  30. cartography/intel/scaleway/storage/__init__.py +0 -0
  31. cartography/intel/scaleway/storage/snapshots.py +86 -0
  32. cartography/intel/scaleway/storage/volumes.py +84 -0
  33. cartography/intel/scaleway/utils.py +37 -0
  34. cartography/intel/sentinelone/__init__.py +63 -0
  35. cartography/intel/sentinelone/account.py +140 -0
  36. cartography/intel/sentinelone/agent.py +139 -0
  37. cartography/intel/sentinelone/api.py +113 -0
  38. cartography/intel/sentinelone/utils.py +9 -0
  39. cartography/models/airbyte/__init__.py +0 -0
  40. cartography/models/airbyte/connection.py +138 -0
  41. cartography/models/airbyte/destination.py +75 -0
  42. cartography/models/airbyte/organization.py +19 -0
  43. cartography/models/airbyte/source.py +75 -0
  44. cartography/models/airbyte/stream.py +74 -0
  45. cartography/models/airbyte/tag.py +69 -0
  46. cartography/models/airbyte/user.py +111 -0
  47. cartography/models/airbyte/workspace.py +46 -0
  48. cartography/models/aws/cloudtrail/management_events.py +64 -0
  49. cartography/models/aws/codebuild/__init__.py +0 -0
  50. cartography/models/aws/codebuild/project.py +49 -0
  51. cartography/models/aws/ecs/containers.py +19 -0
  52. cartography/models/aws/ecs/task_definitions.py +38 -0
  53. cartography/models/aws/sns/topic_subscription.py +74 -0
  54. cartography/models/entra/user.py +17 -51
  55. cartography/models/scaleway/__init__.py +0 -0
  56. cartography/models/scaleway/iam/__init__.py +0 -0
  57. cartography/models/scaleway/iam/apikey.py +96 -0
  58. cartography/models/scaleway/iam/application.py +52 -0
  59. cartography/models/scaleway/iam/group.py +95 -0
  60. cartography/models/scaleway/iam/user.py +60 -0
  61. cartography/models/scaleway/instance/__init__.py +0 -0
  62. cartography/models/scaleway/instance/flexibleip.py +52 -0
  63. cartography/models/scaleway/instance/instance.py +118 -0
  64. cartography/models/scaleway/organization.py +19 -0
  65. cartography/models/scaleway/project.py +48 -0
  66. cartography/models/scaleway/storage/__init__.py +0 -0
  67. cartography/models/scaleway/storage/snapshot.py +78 -0
  68. cartography/models/scaleway/storage/volume.py +51 -0
  69. cartography/models/sentinelone/__init__.py +1 -0
  70. cartography/models/sentinelone/account.py +40 -0
  71. cartography/models/sentinelone/agent.py +50 -0
  72. cartography/sync.py +11 -4
  73. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/METADATA +20 -16
  74. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/RECORD +78 -18
  75. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/WHEEL +0 -0
  76. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/entry_points.txt +0 -0
  77. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/licenses/LICENSE +0 -0
  78. {cartography-0.106.0rc2.dist-info → cartography-0.107.0rc1.dist-info}/top_level.txt +0 -0
@@ -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
+ )
@@ -0,0 +1,118 @@
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 ScalewayInstanceProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name")
18
+ tags: PropertyRef = PropertyRef("tags")
19
+ commercial_type: PropertyRef = PropertyRef("commercial_type")
20
+ creation_date: PropertyRef = PropertyRef("creation_date")
21
+ dynamic_ip_required: PropertyRef = PropertyRef("dynamic_ip_required")
22
+ routed_ip_enabled: PropertyRef = PropertyRef("routed_ip_enabled")
23
+ enable_ipv6: PropertyRef = PropertyRef("enable_ipv6")
24
+ hostname: PropertyRef = PropertyRef("hostname")
25
+ private_ip: PropertyRef = PropertyRef("private_ip")
26
+ mac_address: PropertyRef = PropertyRef("mac_address")
27
+ modification_date: PropertyRef = PropertyRef("modification_date")
28
+ state: PropertyRef = PropertyRef("state")
29
+ location_cluster_id: PropertyRef = PropertyRef("location.cluster_id")
30
+ location_hypervisor_id: PropertyRef = PropertyRef("location.hypervisor_id")
31
+ location_node_id: PropertyRef = PropertyRef("location.node_id")
32
+ location_platform_id: PropertyRef = PropertyRef("location.platform_id")
33
+ ipv6_address: PropertyRef = PropertyRef("ipv6.address")
34
+ ipv6_gateway: PropertyRef = PropertyRef("ipv6.gateway")
35
+ ipv6_netmask: PropertyRef = PropertyRef("ipv6.netmask")
36
+ boot_type: PropertyRef = PropertyRef("boot_type")
37
+ state_detail: PropertyRef = PropertyRef("state_detail")
38
+ arch: PropertyRef = PropertyRef("arch")
39
+ private_nics: PropertyRef = PropertyRef("private_nics")
40
+ zone: PropertyRef = PropertyRef("zone")
41
+ end_of_service: PropertyRef = PropertyRef("end_of_service")
42
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class ScalewayInstanceToVolumeProperties(CartographyRelProperties):
47
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
48
+
49
+
50
+ @dataclass(frozen=True)
51
+ # (:ScalewayVolume)<-[:MOUNTS]-(:ScalewayInstance)
52
+ class ScalewayInstanceToVolumeRel(CartographyRelSchema):
53
+ target_node_label: str = "ScalewayVolume"
54
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
55
+ {"id": PropertyRef("volumes_id", one_to_many=True)},
56
+ )
57
+ direction: LinkDirection = LinkDirection.OUTWARD
58
+ rel_label: str = "MOUNTS"
59
+ properties: ScalewayInstanceToVolumeProperties = (
60
+ ScalewayInstanceToVolumeProperties()
61
+ )
62
+
63
+
64
+ @dataclass(frozen=True)
65
+ class ScalewayInstanceToFlexibleIpProperties(CartographyRelProperties):
66
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
67
+
68
+
69
+ @dataclass(frozen=True)
70
+ # (:ScalewayFlexibleIp)-[:IDENTIFIES]->(:ScalewayInstance)
71
+ class ScalewayInstanceToFlexibleIpRel(CartographyRelSchema):
72
+ target_node_label: str = "ScalewayFlexibleIp"
73
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
74
+ {"id": PropertyRef("public_ips", one_to_many=True)},
75
+ )
76
+ direction: LinkDirection = LinkDirection.INWARD
77
+ rel_label: str = "IDENTIFIES"
78
+ properties: ScalewayInstanceToFlexibleIpProperties = (
79
+ ScalewayInstanceToFlexibleIpProperties()
80
+ )
81
+
82
+
83
+ # TODO: Link to Image with image.id
84
+ # TODO: Link to SecurityGroup with security_group.id
85
+ # TODO: Link to PlacementGroup with placement_group.id
86
+
87
+
88
+ @dataclass(frozen=True)
89
+ class ScalewayInstanceToProjectRelProperties(CartographyRelProperties):
90
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
91
+
92
+
93
+ @dataclass(frozen=True)
94
+ # (:ScalewayProject)-[:RESOURCE]->(:ScalewayInstance)
95
+ class ScalewayInstanceToProjectRel(CartographyRelSchema):
96
+ target_node_label: str = "ScalewayProject"
97
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
98
+ {"id": PropertyRef("PROJECT_ID", set_in_kwargs=True)},
99
+ )
100
+ direction: LinkDirection = LinkDirection.INWARD
101
+ rel_label: str = "RESOURCE"
102
+ properties: ScalewayInstanceToProjectRelProperties = (
103
+ ScalewayInstanceToProjectRelProperties()
104
+ )
105
+
106
+
107
+ @dataclass(frozen=True)
108
+ class ScalewayInstanceSchema(CartographyNodeSchema):
109
+ label: str = "ScalewayInstance"
110
+ properties: ScalewayInstanceProperties = ScalewayInstanceProperties()
111
+ sub_resource_relationship: ScalewayInstanceToProjectRel = (
112
+ ScalewayInstanceToProjectRel()
113
+ )
114
+ other_relationships: OtherRelationships = OtherRelationships(
115
+ [
116
+ ScalewayInstanceToVolumeRel(),
117
+ ]
118
+ )
@@ -0,0 +1,19 @@
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 ScalewayOrganizationNodeProperties(CartographyNodeProperties):
10
+ id: PropertyRef = PropertyRef("id")
11
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class ScalewayOrganizationSchema(CartographyNodeSchema):
16
+ label: str = "ScalewayOrganization"
17
+ properties: ScalewayOrganizationNodeProperties = (
18
+ ScalewayOrganizationNodeProperties()
19
+ )
@@ -0,0 +1,48 @@
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 ScalewayProjectNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("id")
16
+ name: PropertyRef = PropertyRef("name")
17
+ created_at: PropertyRef = PropertyRef("created_at")
18
+ updated_at: PropertyRef = PropertyRef("updated_at")
19
+ description: PropertyRef = PropertyRef("description")
20
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class ScalewayProjectToOrganizationRelProperties(CartographyRelProperties):
25
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ # (:ScalewayOrganization)-[:RESOURCE]->(:ScalewayProject)
30
+ class ScalewayProjectToOrganizationRel(CartographyRelSchema):
31
+ target_node_label: str = "ScalewayOrganization"
32
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
33
+ {"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
34
+ )
35
+ direction: LinkDirection = LinkDirection.INWARD
36
+ rel_label: str = "RESOURCE"
37
+ properties: ScalewayProjectToOrganizationRelProperties = (
38
+ ScalewayProjectToOrganizationRelProperties()
39
+ )
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class ScalewayProjectSchema(CartographyNodeSchema):
44
+ label: str = "ScalewayProject"
45
+ properties: ScalewayProjectNodeProperties = ScalewayProjectNodeProperties()
46
+ sub_resource_relationship: ScalewayProjectToOrganizationRel = (
47
+ ScalewayProjectToOrganizationRel()
48
+ )
File without changes
@@ -0,0 +1,78 @@
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 ScalewayVolumeSnapshotNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name")
18
+ tags: PropertyRef = PropertyRef("tags")
19
+ volume_type: PropertyRef = PropertyRef("volume_type")
20
+ size: PropertyRef = PropertyRef("size")
21
+ state: PropertyRef = PropertyRef("state")
22
+ creation_date: PropertyRef = PropertyRef("creation_date")
23
+ modification_date: PropertyRef = PropertyRef("modification_date")
24
+ error_reason: PropertyRef = PropertyRef("error_reason")
25
+ zone: PropertyRef = PropertyRef("zone")
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class ScalewayVolumeSnapshotToProjectRelProperties(CartographyRelProperties):
31
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ # (:ScalewayProject)-[:RESOURCE]->(:ScalewayVolumeSnapshot)
36
+ class ScalewayVolumeSnapshotToProjectRel(CartographyRelSchema):
37
+ target_node_label: str = "ScalewayProject"
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {"id": PropertyRef("PROJECT_ID", set_in_kwargs=True)},
40
+ )
41
+ direction: LinkDirection = LinkDirection.INWARD
42
+ rel_label: str = "RESOURCE"
43
+ properties: ScalewayVolumeSnapshotToProjectRelProperties = (
44
+ ScalewayVolumeSnapshotToProjectRelProperties()
45
+ )
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class ScalewayVolumeSnapshotToInstanceVolumeProperties(CartographyRelProperties):
50
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ # (:ScalewayVolume)-[:HAS]->(:ScalewayVolumeSnapshot)
55
+ class ScalewayVolumeSnapshotToInstanceVolumeRel(CartographyRelSchema):
56
+ target_node_label: str = "ScalewayVolume"
57
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
58
+ {"id": PropertyRef("base_volume.id")},
59
+ )
60
+ direction: LinkDirection = LinkDirection.INWARD
61
+ rel_label: str = "HAS"
62
+ properties: ScalewayVolumeSnapshotToInstanceVolumeProperties = (
63
+ ScalewayVolumeSnapshotToInstanceVolumeProperties()
64
+ )
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class ScalewayVolumeSnapshotSchema(CartographyNodeSchema):
69
+ label: str = "ScalewayVolumeSnapshot"
70
+ properties: ScalewayVolumeSnapshotNodeProperties = (
71
+ ScalewayVolumeSnapshotNodeProperties()
72
+ )
73
+ sub_resource_relationship: ScalewayVolumeSnapshotToProjectRel = (
74
+ ScalewayVolumeSnapshotToProjectRel()
75
+ )
76
+ other_relationships: OtherRelationships = OtherRelationships(
77
+ rels=[ScalewayVolumeSnapshotToInstanceVolumeRel()],
78
+ )