cartography 0.102.0rc2__py3-none-any.whl → 0.103.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.
- cartography/__main__.py +1 -2
- cartography/_version.py +2 -2
- cartography/cli.py +376 -249
- cartography/client/core/tx.py +39 -18
- cartography/config.py +28 -0
- cartography/driftdetect/__main__.py +1 -2
- cartography/driftdetect/add_shortcut.py +10 -2
- cartography/driftdetect/cli.py +71 -75
- cartography/driftdetect/detect_deviations.py +7 -3
- cartography/driftdetect/get_states.py +20 -8
- cartography/driftdetect/model.py +5 -5
- cartography/driftdetect/serializers.py +8 -6
- cartography/driftdetect/storage.py +2 -2
- cartography/graph/cleanupbuilder.py +35 -15
- cartography/graph/job.py +46 -17
- cartography/graph/querybuilder.py +165 -80
- cartography/graph/statement.py +35 -26
- cartography/intel/analysis.py +4 -1
- cartography/intel/aws/__init__.py +114 -55
- cartography/intel/aws/apigateway.py +134 -63
- cartography/intel/aws/cloudtrail.py +127 -0
- cartography/intel/aws/cloudwatch.py +93 -0
- cartography/intel/aws/config.py +56 -20
- cartography/intel/aws/dynamodb.py +108 -40
- cartography/intel/aws/ec2/__init__.py +2 -2
- cartography/intel/aws/ec2/auto_scaling_groups.py +181 -78
- cartography/intel/aws/ec2/elastic_ip_addresses.py +41 -13
- cartography/intel/aws/ec2/images.py +49 -20
- cartography/intel/aws/ec2/instances.py +234 -136
- cartography/intel/aws/ec2/internet_gateways.py +40 -11
- cartography/intel/aws/ec2/key_pairs.py +44 -20
- cartography/intel/aws/ec2/launch_templates.py +101 -59
- cartography/intel/aws/ec2/load_balancer_v2s.py +104 -39
- cartography/intel/aws/ec2/load_balancers.py +82 -42
- cartography/intel/aws/ec2/network_acls.py +89 -65
- cartography/intel/aws/ec2/network_interfaces.py +146 -87
- cartography/intel/aws/ec2/reserved_instances.py +45 -16
- cartography/intel/aws/ec2/route_tables.py +138 -98
- cartography/intel/aws/ec2/security_groups.py +71 -21
- cartography/intel/aws/ec2/snapshots.py +61 -22
- cartography/intel/aws/ec2/subnets.py +54 -18
- cartography/intel/aws/ec2/tgw.py +100 -34
- cartography/intel/aws/ec2/util.py +1 -1
- cartography/intel/aws/ec2/volumes.py +69 -41
- cartography/intel/aws/ec2/vpc.py +37 -12
- cartography/intel/aws/ec2/vpc_peerings.py +83 -24
- cartography/intel/aws/ecr.py +88 -32
- cartography/intel/aws/ecs.py +83 -47
- cartography/intel/aws/efs.py +93 -0
- cartography/intel/aws/eks.py +55 -29
- cartography/intel/aws/elasticache.py +42 -18
- cartography/intel/aws/elasticsearch.py +57 -20
- cartography/intel/aws/emr.py +61 -23
- cartography/intel/aws/iam.py +401 -145
- cartography/intel/aws/iam_instance_profiles.py +22 -22
- cartography/intel/aws/identitycenter.py +71 -37
- cartography/intel/aws/inspector.py +159 -89
- cartography/intel/aws/kms.py +92 -38
- cartography/intel/aws/lambda_function.py +103 -34
- cartography/intel/aws/organizations.py +30 -10
- cartography/intel/aws/permission_relationships.py +133 -51
- cartography/intel/aws/rds.py +249 -85
- cartography/intel/aws/redshift.py +107 -46
- cartography/intel/aws/resourcegroupstaggingapi.py +120 -66
- cartography/intel/aws/resources.py +57 -46
- cartography/intel/aws/route53.py +108 -61
- cartography/intel/aws/s3.py +168 -83
- cartography/intel/aws/s3accountpublicaccessblock.py +157 -0
- cartography/intel/aws/secretsmanager.py +24 -12
- cartography/intel/aws/securityhub.py +20 -9
- cartography/intel/aws/sns.py +166 -0
- cartography/intel/aws/sqs.py +60 -28
- cartography/intel/aws/ssm.py +70 -30
- cartography/intel/aws/util/arns.py +7 -7
- cartography/intel/aws/util/common.py +31 -4
- cartography/intel/azure/__init__.py +78 -19
- cartography/intel/azure/compute.py +101 -27
- cartography/intel/azure/cosmosdb.py +496 -170
- cartography/intel/azure/sql.py +296 -105
- cartography/intel/azure/storage.py +322 -113
- cartography/intel/azure/subscription.py +39 -23
- cartography/intel/azure/tenant.py +13 -4
- cartography/intel/azure/util/credentials.py +95 -55
- cartography/intel/bigfix/__init__.py +2 -2
- cartography/intel/bigfix/computers.py +93 -65
- cartography/intel/cloudflare/__init__.py +74 -0
- cartography/intel/cloudflare/accounts.py +57 -0
- cartography/intel/cloudflare/dnsrecords.py +64 -0
- cartography/intel/cloudflare/members.py +75 -0
- cartography/intel/cloudflare/roles.py +65 -0
- cartography/intel/cloudflare/zones.py +64 -0
- cartography/intel/create_indexes.py +3 -2
- cartography/intel/crowdstrike/__init__.py +11 -9
- cartography/intel/crowdstrike/endpoints.py +5 -1
- cartography/intel/crowdstrike/spotlight.py +8 -3
- cartography/intel/cve/__init__.py +46 -13
- cartography/intel/cve/feed.py +48 -12
- cartography/intel/digitalocean/__init__.py +22 -13
- cartography/intel/digitalocean/compute.py +75 -108
- cartography/intel/digitalocean/management.py +44 -80
- cartography/intel/digitalocean/platform.py +48 -43
- cartography/intel/dns.py +36 -10
- cartography/intel/duo/__init__.py +21 -16
- cartography/intel/duo/api_host.py +14 -9
- cartography/intel/duo/endpoints.py +50 -45
- cartography/intel/duo/groups.py +18 -14
- cartography/intel/duo/phones.py +37 -34
- cartography/intel/duo/tokens.py +26 -23
- cartography/intel/duo/users.py +54 -50
- cartography/intel/duo/web_authn_credentials.py +30 -25
- cartography/intel/entra/__init__.py +25 -7
- cartography/intel/entra/ou.py +112 -0
- cartography/intel/entra/users.py +69 -63
- cartography/intel/gcp/__init__.py +185 -49
- cartography/intel/gcp/compute.py +418 -231
- cartography/intel/gcp/crm.py +96 -43
- cartography/intel/gcp/dns.py +60 -19
- cartography/intel/gcp/gke.py +72 -38
- cartography/intel/gcp/iam.py +61 -41
- cartography/intel/gcp/storage.py +84 -55
- cartography/intel/github/__init__.py +13 -11
- cartography/intel/github/repos.py +270 -137
- cartography/intel/github/teams.py +170 -88
- cartography/intel/github/users.py +70 -39
- cartography/intel/github/util.py +36 -34
- cartography/intel/gsuite/__init__.py +47 -26
- cartography/intel/gsuite/api.py +73 -30
- cartography/intel/jamf/__init__.py +19 -1
- cartography/intel/jamf/computers.py +30 -7
- cartography/intel/jamf/util.py +7 -2
- cartography/intel/kandji/__init__.py +6 -3
- cartography/intel/kandji/devices.py +14 -8
- cartography/intel/kubernetes/namespaces.py +7 -4
- cartography/intel/kubernetes/pods.py +7 -4
- cartography/intel/kubernetes/services.py +8 -4
- cartography/intel/lastpass/__init__.py +2 -2
- cartography/intel/lastpass/users.py +23 -12
- cartography/intel/oci/__init__.py +44 -11
- cartography/intel/oci/iam.py +134 -38
- cartography/intel/oci/organizations.py +13 -6
- cartography/intel/oci/utils.py +43 -20
- cartography/intel/okta/__init__.py +66 -15
- cartography/intel/okta/applications.py +42 -20
- cartography/intel/okta/awssaml.py +93 -33
- cartography/intel/okta/factors.py +16 -4
- cartography/intel/okta/groups.py +56 -29
- cartography/intel/okta/organization.py +5 -1
- cartography/intel/okta/origins.py +6 -2
- cartography/intel/okta/roles.py +15 -5
- cartography/intel/okta/users.py +20 -8
- cartography/intel/okta/utils.py +6 -4
- cartography/intel/openai/__init__.py +86 -0
- cartography/intel/openai/adminapikeys.py +90 -0
- cartography/intel/openai/apikeys.py +96 -0
- cartography/intel/openai/projects.py +94 -0
- cartography/intel/openai/serviceaccounts.py +82 -0
- cartography/intel/openai/users.py +78 -0
- cartography/intel/openai/util.py +29 -0
- cartography/intel/pagerduty/__init__.py +8 -7
- cartography/intel/pagerduty/escalation_policies.py +18 -6
- cartography/intel/pagerduty/schedules.py +12 -4
- cartography/intel/pagerduty/services.py +11 -4
- cartography/intel/pagerduty/teams.py +8 -3
- cartography/intel/pagerduty/users.py +3 -1
- cartography/intel/pagerduty/vendors.py +3 -1
- cartography/intel/semgrep/__init__.py +24 -6
- cartography/intel/semgrep/dependencies.py +50 -28
- cartography/intel/semgrep/deployment.py +3 -1
- cartography/intel/semgrep/findings.py +42 -18
- cartography/intel/snipeit/__init__.py +17 -3
- cartography/intel/snipeit/asset.py +12 -6
- cartography/intel/snipeit/user.py +8 -5
- cartography/intel/snipeit/util.py +9 -4
- cartography/intel/tailscale/__init__.py +77 -0
- cartography/intel/tailscale/acls.py +146 -0
- cartography/intel/tailscale/devices.py +127 -0
- cartography/intel/tailscale/postureintegrations.py +81 -0
- cartography/intel/tailscale/tailnets.py +76 -0
- cartography/intel/tailscale/users.py +80 -0
- cartography/intel/tailscale/utils.py +132 -0
- cartography/models/aws/apigateway.py +21 -17
- cartography/models/aws/apigatewaycertificate.py +28 -22
- cartography/models/aws/apigatewayresource.py +28 -20
- cartography/models/aws/apigatewaystage.py +33 -25
- cartography/models/aws/cloudtrail/__init__.py +0 -0
- cartography/models/aws/cloudtrail/trail.py +61 -0
- cartography/models/aws/cloudwatch/__init__.py +0 -0
- cartography/models/aws/cloudwatch/loggroup.py +52 -0
- cartography/models/aws/dynamodb/gsi.py +30 -22
- cartography/models/aws/dynamodb/tables.py +25 -17
- cartography/models/aws/ec2/auto_scaling_groups.py +102 -82
- cartography/models/aws/ec2/images.py +36 -34
- cartography/models/aws/ec2/instances.py +51 -45
- cartography/models/aws/ec2/keypair.py +21 -16
- cartography/models/aws/ec2/keypair_instance.py +28 -21
- cartography/models/aws/ec2/launch_configurations.py +30 -26
- cartography/models/aws/ec2/launch_template_versions.py +48 -38
- cartography/models/aws/ec2/launch_templates.py +21 -17
- cartography/models/aws/ec2/load_balancer_listeners.py +27 -23
- cartography/models/aws/ec2/load_balancers.py +47 -37
- cartography/models/aws/ec2/network_acl_rules.py +38 -30
- cartography/models/aws/ec2/network_acls.py +38 -29
- cartography/models/aws/ec2/networkinterface_instance.py +52 -39
- cartography/models/aws/ec2/networkinterfaces.py +53 -37
- cartography/models/aws/ec2/privateip_networkinterface.py +32 -22
- cartography/models/aws/ec2/reservations.py +18 -14
- cartography/models/aws/ec2/route_table_associations.py +44 -34
- cartography/models/aws/ec2/route_tables.py +50 -43
- cartography/models/aws/ec2/routes.py +45 -37
- cartography/models/aws/ec2/securitygroup_instance.py +29 -20
- cartography/models/aws/ec2/securitygroup_networkinterface.py +24 -15
- cartography/models/aws/ec2/subnet_instance.py +24 -19
- cartography/models/aws/ec2/subnet_networkinterface.py +40 -31
- cartography/models/aws/ec2/volumes.py +47 -40
- cartography/models/aws/efs/__init__.py +0 -0
- cartography/models/aws/efs/mount_target.py +52 -0
- cartography/models/aws/eks/clusters.py +23 -21
- cartography/models/aws/emr.py +32 -30
- cartography/models/aws/iam/instanceprofile.py +33 -24
- cartography/models/aws/identitycenter/awsidentitycenter.py +18 -14
- cartography/models/aws/identitycenter/awspermissionset.py +37 -29
- cartography/models/aws/identitycenter/awsssouser.py +23 -21
- cartography/models/aws/inspector/findings.py +77 -65
- cartography/models/aws/inspector/packages.py +35 -29
- cartography/models/aws/s3/__init__.py +0 -0
- cartography/models/aws/s3/account_public_access_block.py +51 -0
- cartography/models/aws/sns/__init__.py +0 -0
- cartography/models/aws/sns/topic.py +50 -0
- cartography/models/aws/ssm/instance_information.py +51 -39
- cartography/models/aws/ssm/instance_patch.py +32 -26
- cartography/models/bigfix/bigfix_computer.py +42 -38
- cartography/models/bigfix/bigfix_root.py +3 -3
- cartography/models/cloudflare/__init__.py +0 -0
- cartography/models/cloudflare/account.py +25 -0
- cartography/models/cloudflare/dnsrecord.py +55 -0
- cartography/models/cloudflare/member.py +82 -0
- cartography/models/cloudflare/role.py +44 -0
- cartography/models/cloudflare/zone.py +59 -0
- cartography/models/core/common.py +12 -10
- cartography/models/core/nodes.py +5 -2
- cartography/models/core/relationships.py +14 -6
- cartography/models/crowdstrike/hosts.py +37 -35
- cartography/models/cve/cve.py +34 -32
- cartography/models/cve/cve_feed.py +6 -6
- cartography/models/digitalocean/__init__.py +0 -0
- cartography/models/digitalocean/account.py +21 -0
- cartography/models/digitalocean/droplet.py +56 -0
- cartography/models/digitalocean/project.py +48 -0
- cartography/models/duo/api_host.py +3 -3
- cartography/models/duo/endpoint.py +43 -41
- cartography/models/duo/group.py +14 -14
- cartography/models/duo/phone.py +27 -27
- cartography/models/duo/token.py +16 -16
- cartography/models/duo/user.py +46 -44
- cartography/models/duo/web_authn_credential.py +27 -19
- cartography/models/entra/ou.py +48 -0
- cartography/models/entra/tenant.py +24 -18
- cartography/models/entra/user.py +64 -48
- cartography/models/gcp/iam.py +23 -23
- cartography/models/github/orgs.py +5 -4
- cartography/models/github/teams.py +37 -31
- cartography/models/github/users.py +34 -23
- cartography/models/kandji/device.py +22 -16
- cartography/models/kandji/tenant.py +6 -4
- cartography/models/lastpass/tenant.py +3 -3
- cartography/models/lastpass/user.py +32 -28
- cartography/models/openai/__init__.py +0 -0
- cartography/models/openai/adminapikey.py +90 -0
- cartography/models/openai/apikey.py +84 -0
- cartography/models/openai/organization.py +17 -0
- cartography/models/openai/project.py +70 -0
- cartography/models/openai/serviceaccount.py +50 -0
- cartography/models/openai/user.py +49 -0
- cartography/models/semgrep/dependencies.py +36 -24
- cartography/models/semgrep/deployment.py +5 -5
- cartography/models/semgrep/findings.py +58 -42
- cartography/models/semgrep/locations.py +27 -21
- cartography/models/snipeit/asset.py +30 -21
- cartography/models/snipeit/tenant.py +6 -4
- cartography/models/snipeit/user.py +19 -12
- cartography/models/tailscale/__init__.py +0 -0
- cartography/models/tailscale/device.py +95 -0
- cartography/models/tailscale/group.py +86 -0
- cartography/models/tailscale/postureintegration.py +58 -0
- cartography/models/tailscale/tag.py +102 -0
- cartography/models/tailscale/tailnet.py +29 -0
- cartography/models/tailscale/user.py +52 -0
- cartography/stats.py +3 -3
- cartography/sync.py +113 -31
- cartography/util.py +84 -62
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0.dist-info}/METADATA +8 -15
- cartography-0.103.0.dist-info/RECORD +442 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0.dist-info}/WHEEL +1 -1
- cartography-0.102.0rc2.dist-info/RECORD +0 -381
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0.dist-info}/top_level.txt +0 -0
|
@@ -13,23 +13,23 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True)
|
|
15
15
|
class GitHubTeamNodeProperties(CartographyNodeProperties):
|
|
16
|
-
id: PropertyRef = PropertyRef(
|
|
17
|
-
url: PropertyRef = PropertyRef(
|
|
18
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
19
|
-
name: PropertyRef = PropertyRef(
|
|
20
|
-
description: PropertyRef = PropertyRef(
|
|
16
|
+
id: PropertyRef = PropertyRef("url")
|
|
17
|
+
url: PropertyRef = PropertyRef("url")
|
|
18
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
19
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
20
|
+
description: PropertyRef = PropertyRef("description")
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
@dataclass(frozen=True)
|
|
24
24
|
class GitHubTeamToRepoRelProperties(CartographyRelProperties):
|
|
25
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
@dataclass(frozen=True)
|
|
29
29
|
class GitHubTeamAdminRepoRel(CartographyRelSchema):
|
|
30
|
-
target_node_label: str =
|
|
30
|
+
target_node_label: str = "GitHubRepository"
|
|
31
31
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
-
{
|
|
32
|
+
{"id": PropertyRef("ADMIN")},
|
|
33
33
|
)
|
|
34
34
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
35
35
|
rel_label: str = "ADMIN"
|
|
@@ -38,9 +38,9 @@ class GitHubTeamAdminRepoRel(CartographyRelSchema):
|
|
|
38
38
|
|
|
39
39
|
@dataclass(frozen=True)
|
|
40
40
|
class GitHubTeamMaintainRepoRel(CartographyRelSchema):
|
|
41
|
-
target_node_label: str =
|
|
41
|
+
target_node_label: str = "GitHubRepository"
|
|
42
42
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
43
|
-
{
|
|
43
|
+
{"id": PropertyRef("MAINTAIN")},
|
|
44
44
|
)
|
|
45
45
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
46
46
|
rel_label: str = "MAINTAIN"
|
|
@@ -49,9 +49,9 @@ class GitHubTeamMaintainRepoRel(CartographyRelSchema):
|
|
|
49
49
|
|
|
50
50
|
@dataclass(frozen=True)
|
|
51
51
|
class GitHubTeamReadRepoRel(CartographyRelSchema):
|
|
52
|
-
target_node_label: str =
|
|
52
|
+
target_node_label: str = "GitHubRepository"
|
|
53
53
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
54
|
-
{
|
|
54
|
+
{"id": PropertyRef("READ")},
|
|
55
55
|
)
|
|
56
56
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
57
57
|
rel_label: str = "READ"
|
|
@@ -60,9 +60,9 @@ class GitHubTeamReadRepoRel(CartographyRelSchema):
|
|
|
60
60
|
|
|
61
61
|
@dataclass(frozen=True)
|
|
62
62
|
class GitHubTeamTriageRepoRel(CartographyRelSchema):
|
|
63
|
-
target_node_label: str =
|
|
63
|
+
target_node_label: str = "GitHubRepository"
|
|
64
64
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
65
|
-
{
|
|
65
|
+
{"id": PropertyRef("TRIAGE")},
|
|
66
66
|
)
|
|
67
67
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
68
68
|
rel_label: str = "TRIAGE"
|
|
@@ -71,9 +71,9 @@ class GitHubTeamTriageRepoRel(CartographyRelSchema):
|
|
|
71
71
|
|
|
72
72
|
@dataclass(frozen=True)
|
|
73
73
|
class GitHubTeamWriteRepoRel(CartographyRelSchema):
|
|
74
|
-
target_node_label: str =
|
|
74
|
+
target_node_label: str = "GitHubRepository"
|
|
75
75
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
76
|
-
{
|
|
76
|
+
{"id": PropertyRef("WRITE")},
|
|
77
77
|
)
|
|
78
78
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
79
79
|
rel_label: str = "WRITE"
|
|
@@ -82,14 +82,14 @@ class GitHubTeamWriteRepoRel(CartographyRelSchema):
|
|
|
82
82
|
|
|
83
83
|
@dataclass(frozen=True)
|
|
84
84
|
class GitHubTeamToUserRelProperties(CartographyRelProperties):
|
|
85
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
85
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
@dataclass(frozen=True)
|
|
89
89
|
class GitHubTeamMaintainerUserRel(CartographyRelSchema):
|
|
90
|
-
target_node_label: str =
|
|
90
|
+
target_node_label: str = "GitHubUser"
|
|
91
91
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
92
|
-
{
|
|
92
|
+
{"id": PropertyRef("MAINTAINER")},
|
|
93
93
|
)
|
|
94
94
|
direction: LinkDirection = LinkDirection.INWARD
|
|
95
95
|
rel_label: str = "MAINTAINER"
|
|
@@ -98,9 +98,9 @@ class GitHubTeamMaintainerUserRel(CartographyRelSchema):
|
|
|
98
98
|
|
|
99
99
|
@dataclass(frozen=True)
|
|
100
100
|
class GitHubTeamMemberUserRel(CartographyRelSchema):
|
|
101
|
-
target_node_label: str =
|
|
101
|
+
target_node_label: str = "GitHubUser"
|
|
102
102
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
103
|
-
{
|
|
103
|
+
{"id": PropertyRef("MEMBER")},
|
|
104
104
|
)
|
|
105
105
|
direction: LinkDirection = LinkDirection.INWARD
|
|
106
106
|
rel_label: str = "MEMBER"
|
|
@@ -109,39 +109,43 @@ class GitHubTeamMemberUserRel(CartographyRelSchema):
|
|
|
109
109
|
|
|
110
110
|
@dataclass(frozen=True)
|
|
111
111
|
class GitHubTeamToOrganizationRelProperties(CartographyRelProperties):
|
|
112
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
112
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
@dataclass(frozen=True)
|
|
116
116
|
class GitHubTeamToOrganizationRel(CartographyRelSchema):
|
|
117
|
-
target_node_label: str =
|
|
117
|
+
target_node_label: str = "GitHubOrganization"
|
|
118
118
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
119
|
-
{
|
|
119
|
+
{"id": PropertyRef("org_url", set_in_kwargs=True)},
|
|
120
120
|
)
|
|
121
121
|
direction: LinkDirection = LinkDirection.INWARD
|
|
122
122
|
rel_label: str = "RESOURCE"
|
|
123
|
-
properties: GitHubTeamToOrganizationRelProperties =
|
|
123
|
+
properties: GitHubTeamToOrganizationRelProperties = (
|
|
124
|
+
GitHubTeamToOrganizationRelProperties()
|
|
125
|
+
)
|
|
124
126
|
|
|
125
127
|
|
|
126
128
|
@dataclass(frozen=True)
|
|
127
129
|
class GitHubTeamToChildTeamRelProperties(CartographyRelProperties):
|
|
128
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
130
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
129
131
|
|
|
130
132
|
|
|
131
133
|
@dataclass(frozen=True)
|
|
132
134
|
class GitHubTeamChildTeamRel(CartographyRelSchema):
|
|
133
|
-
target_node_label: str =
|
|
135
|
+
target_node_label: str = "GitHubTeam"
|
|
134
136
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
135
|
-
{
|
|
137
|
+
{"id": PropertyRef("MEMBER_OF_TEAM")},
|
|
136
138
|
)
|
|
137
139
|
direction: LinkDirection = LinkDirection.INWARD
|
|
138
140
|
rel_label: str = "MEMBER_OF_TEAM"
|
|
139
|
-
properties: GitHubTeamToChildTeamRelProperties =
|
|
141
|
+
properties: GitHubTeamToChildTeamRelProperties = (
|
|
142
|
+
GitHubTeamToChildTeamRelProperties()
|
|
143
|
+
)
|
|
140
144
|
|
|
141
145
|
|
|
142
146
|
@dataclass(frozen=True)
|
|
143
147
|
class GitHubTeamSchema(CartographyNodeSchema):
|
|
144
|
-
label: str =
|
|
148
|
+
label: str = "GitHubTeam"
|
|
145
149
|
properties: GitHubTeamNodeProperties = GitHubTeamNodeProperties()
|
|
146
150
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
147
151
|
[
|
|
@@ -155,4 +159,6 @@ class GitHubTeamSchema(CartographyNodeSchema):
|
|
|
155
159
|
GitHubTeamChildTeamRel(),
|
|
156
160
|
],
|
|
157
161
|
)
|
|
158
|
-
sub_resource_relationship: GitHubTeamToOrganizationRel =
|
|
162
|
+
sub_resource_relationship: GitHubTeamToOrganizationRel = (
|
|
163
|
+
GitHubTeamToOrganizationRel()
|
|
164
|
+
)
|
|
@@ -27,6 +27,7 @@ The main importance of having two schemas is to allow the two sets of users to b
|
|
|
27
27
|
an unaffiliated user, but the user already exists in the graph (perhaps they are members of another GitHub orgs for
|
|
28
28
|
example), then loading the unaffiliated user will not blank out the 'has_2fa_enabled' property.
|
|
29
29
|
"""
|
|
30
|
+
|
|
30
31
|
from dataclasses import dataclass
|
|
31
32
|
|
|
32
33
|
from cartography.models.core.common import PropertyRef
|
|
@@ -43,20 +44,20 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
43
44
|
@dataclass(frozen=True)
|
|
44
45
|
class BaseGitHubUserNodeProperties(CartographyNodeProperties):
|
|
45
46
|
# core properties in all GitHubUser nodes
|
|
46
|
-
id: PropertyRef = PropertyRef(
|
|
47
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
48
|
-
fullname: PropertyRef = PropertyRef(
|
|
49
|
-
username: PropertyRef = PropertyRef(
|
|
50
|
-
is_site_admin: PropertyRef = PropertyRef(
|
|
51
|
-
is_enterprise_owner: PropertyRef = PropertyRef(
|
|
52
|
-
email: PropertyRef = PropertyRef(
|
|
53
|
-
company: PropertyRef = PropertyRef(
|
|
47
|
+
id: PropertyRef = PropertyRef("url")
|
|
48
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
49
|
+
fullname: PropertyRef = PropertyRef("name")
|
|
50
|
+
username: PropertyRef = PropertyRef("login", extra_index=True)
|
|
51
|
+
is_site_admin: PropertyRef = PropertyRef("isSiteAdmin")
|
|
52
|
+
is_enterprise_owner: PropertyRef = PropertyRef("isEnterpriseOwner")
|
|
53
|
+
email: PropertyRef = PropertyRef("email")
|
|
54
|
+
company: PropertyRef = PropertyRef("company")
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
@dataclass(frozen=True)
|
|
57
58
|
class GitHubOrganizationUserNodeProperties(BaseGitHubUserNodeProperties):
|
|
58
59
|
# specified for affiliated users only. The GitHub api does not return this property for unaffiliated users.
|
|
59
|
-
has_2fa_enabled: PropertyRef = PropertyRef(
|
|
60
|
+
has_2fa_enabled: PropertyRef = PropertyRef("hasTwoFactorEnabled")
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
@dataclass(frozen=True)
|
|
@@ -67,46 +68,54 @@ class GitHubUnaffiliatedUserNodeProperties(BaseGitHubUserNodeProperties):
|
|
|
67
68
|
|
|
68
69
|
@dataclass(frozen=True)
|
|
69
70
|
class GitHubUserToOrganizationRelProperties(CartographyRelProperties):
|
|
70
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
71
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
@dataclass(frozen=True)
|
|
74
75
|
class GitHubUserMemberOfOrganizationRel(CartographyRelSchema):
|
|
75
|
-
target_node_label: str =
|
|
76
|
+
target_node_label: str = "GitHubOrganization"
|
|
76
77
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
77
|
-
{
|
|
78
|
+
{"id": PropertyRef("MEMBER_OF")},
|
|
78
79
|
)
|
|
79
80
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
80
81
|
rel_label: str = "MEMBER_OF"
|
|
81
|
-
properties: GitHubUserToOrganizationRelProperties =
|
|
82
|
+
properties: GitHubUserToOrganizationRelProperties = (
|
|
83
|
+
GitHubUserToOrganizationRelProperties()
|
|
84
|
+
)
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
@dataclass(frozen=True)
|
|
85
88
|
class GitHubUserAdminOfOrganizationRel(CartographyRelSchema):
|
|
86
|
-
target_node_label: str =
|
|
89
|
+
target_node_label: str = "GitHubOrganization"
|
|
87
90
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
88
|
-
{
|
|
91
|
+
{"id": PropertyRef("ADMIN_OF")},
|
|
89
92
|
)
|
|
90
93
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
91
94
|
rel_label: str = "ADMIN_OF"
|
|
92
|
-
properties: GitHubUserToOrganizationRelProperties =
|
|
95
|
+
properties: GitHubUserToOrganizationRelProperties = (
|
|
96
|
+
GitHubUserToOrganizationRelProperties()
|
|
97
|
+
)
|
|
93
98
|
|
|
94
99
|
|
|
95
100
|
@dataclass(frozen=True)
|
|
96
101
|
class GitHubUserUnaffiliatedOrganizationRel(CartographyRelSchema):
|
|
97
|
-
target_node_label: str =
|
|
102
|
+
target_node_label: str = "GitHubOrganization"
|
|
98
103
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
99
|
-
{
|
|
104
|
+
{"id": PropertyRef("UNAFFILIATED")},
|
|
100
105
|
)
|
|
101
106
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
102
107
|
rel_label: str = "UNAFFILIATED"
|
|
103
|
-
properties: GitHubUserToOrganizationRelProperties =
|
|
108
|
+
properties: GitHubUserToOrganizationRelProperties = (
|
|
109
|
+
GitHubUserToOrganizationRelProperties()
|
|
110
|
+
)
|
|
104
111
|
|
|
105
112
|
|
|
106
113
|
@dataclass(frozen=True)
|
|
107
114
|
class GitHubOrganizationUserSchema(CartographyNodeSchema):
|
|
108
|
-
label: str =
|
|
109
|
-
properties: GitHubOrganizationUserNodeProperties =
|
|
115
|
+
label: str = "GitHubUser"
|
|
116
|
+
properties: GitHubOrganizationUserNodeProperties = (
|
|
117
|
+
GitHubOrganizationUserNodeProperties()
|
|
118
|
+
)
|
|
110
119
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
111
120
|
[
|
|
112
121
|
GitHubUserMemberOfOrganizationRel(),
|
|
@@ -118,8 +127,10 @@ class GitHubOrganizationUserSchema(CartographyNodeSchema):
|
|
|
118
127
|
|
|
119
128
|
@dataclass(frozen=True)
|
|
120
129
|
class GitHubUnaffiliatedUserSchema(CartographyNodeSchema):
|
|
121
|
-
label: str =
|
|
122
|
-
properties: GitHubUnaffiliatedUserNodeProperties =
|
|
130
|
+
label: str = "GitHubUser"
|
|
131
|
+
properties: GitHubUnaffiliatedUserNodeProperties = (
|
|
132
|
+
GitHubUnaffiliatedUserNodeProperties()
|
|
133
|
+
)
|
|
123
134
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
124
135
|
[
|
|
125
136
|
GitHubUserUnaffiliatedOrganizationRel(),
|
|
@@ -12,37 +12,43 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
12
12
|
|
|
13
13
|
@dataclass(frozen=True)
|
|
14
14
|
class KandjiDeviceNodeProperties(CartographyNodeProperties):
|
|
15
|
-
id: PropertyRef = PropertyRef(
|
|
16
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
17
|
|
|
18
|
-
device_id: PropertyRef = PropertyRef(
|
|
19
|
-
device_name: PropertyRef = PropertyRef(
|
|
20
|
-
last_check_in: PropertyRef = PropertyRef(
|
|
21
|
-
model: PropertyRef = PropertyRef(
|
|
22
|
-
os_version: PropertyRef = PropertyRef(
|
|
23
|
-
platform: PropertyRef = PropertyRef(
|
|
24
|
-
serial_number: PropertyRef = PropertyRef(
|
|
18
|
+
device_id: PropertyRef = PropertyRef("device_id")
|
|
19
|
+
device_name: PropertyRef = PropertyRef("device_name")
|
|
20
|
+
last_check_in: PropertyRef = PropertyRef("last_check_in")
|
|
21
|
+
model: PropertyRef = PropertyRef("model")
|
|
22
|
+
os_version: PropertyRef = PropertyRef("os_version")
|
|
23
|
+
platform: PropertyRef = PropertyRef("platform")
|
|
24
|
+
serial_number: PropertyRef = PropertyRef("serial_number", extra_index=True)
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@dataclass(frozen=True)
|
|
28
28
|
class KandjiTenantToKandjiDeviceRelProperties(CartographyRelProperties):
|
|
29
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
29
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
@dataclass(frozen=True)
|
|
33
33
|
# (:KandjiDevice)-[:ENROLLED_TO]->(:KandjiTenant)
|
|
34
34
|
class KandjiTenantToKandjiDeviceRel(CartographyRelSchema):
|
|
35
|
-
target_node_label: str =
|
|
35
|
+
target_node_label: str = "KandjiTenant"
|
|
36
36
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
-
{
|
|
37
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
38
38
|
)
|
|
39
39
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
40
40
|
rel_label: str = "ENROLLED_TO"
|
|
41
|
-
properties: KandjiTenantToKandjiDeviceRelProperties =
|
|
41
|
+
properties: KandjiTenantToKandjiDeviceRelProperties = (
|
|
42
|
+
KandjiTenantToKandjiDeviceRelProperties()
|
|
43
|
+
)
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
@dataclass(frozen=True)
|
|
45
47
|
class KandjiDeviceSchema(CartographyNodeSchema):
|
|
46
|
-
label: str =
|
|
47
|
-
properties: KandjiDeviceNodeProperties =
|
|
48
|
-
|
|
48
|
+
label: str = "KandjiDevice" # The label of the node
|
|
49
|
+
properties: KandjiDeviceNodeProperties = (
|
|
50
|
+
KandjiDeviceNodeProperties()
|
|
51
|
+
) # An object representing all properties
|
|
52
|
+
sub_resource_relationship: KandjiTenantToKandjiDeviceRel = (
|
|
53
|
+
KandjiTenantToKandjiDeviceRel()
|
|
54
|
+
)
|
|
@@ -7,11 +7,13 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class KandjiTenantNodeProperties(CartographyNodeProperties):
|
|
10
|
-
id: PropertyRef = PropertyRef(
|
|
11
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
10
|
+
id: PropertyRef = PropertyRef("id")
|
|
11
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True)
|
|
15
15
|
class KandjiTenantSchema(CartographyNodeSchema):
|
|
16
|
-
label: str =
|
|
17
|
-
properties: KandjiTenantNodeProperties =
|
|
16
|
+
label: str = "KandjiTenant" # The label of the node
|
|
17
|
+
properties: KandjiTenantNodeProperties = (
|
|
18
|
+
KandjiTenantNodeProperties()
|
|
19
|
+
) # An object representing all properties
|
|
@@ -7,11 +7,11 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class LastpassTenantNodeProperties(CartographyNodeProperties):
|
|
10
|
-
id: PropertyRef = PropertyRef(
|
|
11
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
10
|
+
id: PropertyRef = PropertyRef("id")
|
|
11
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True)
|
|
15
15
|
class LastpassTenantSchema(CartographyNodeSchema):
|
|
16
|
-
label: str =
|
|
16
|
+
label: str = "LastpassTenant"
|
|
17
17
|
properties: LastpassTenantNodeProperties = LastpassTenantNodeProperties()
|
|
@@ -13,38 +13,38 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True)
|
|
15
15
|
class LastpassUserNodeProperties(CartographyNodeProperties):
|
|
16
|
-
id: PropertyRef = PropertyRef(
|
|
17
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
18
|
-
name: PropertyRef = PropertyRef(
|
|
19
|
-
email: PropertyRef = PropertyRef(
|
|
20
|
-
created: PropertyRef = PropertyRef(
|
|
21
|
-
last_pw_change: PropertyRef = PropertyRef(
|
|
22
|
-
last_login: PropertyRef = PropertyRef(
|
|
23
|
-
neverloggedin: PropertyRef = PropertyRef(
|
|
24
|
-
disabled: PropertyRef = PropertyRef(
|
|
25
|
-
admin: PropertyRef = PropertyRef(
|
|
26
|
-
totalscore: PropertyRef = PropertyRef(
|
|
27
|
-
mpstrength: PropertyRef = PropertyRef(
|
|
28
|
-
sites: PropertyRef = PropertyRef(
|
|
29
|
-
notes: PropertyRef = PropertyRef(
|
|
30
|
-
formfills: PropertyRef = PropertyRef(
|
|
31
|
-
applications: PropertyRef = PropertyRef(
|
|
32
|
-
attachments: PropertyRef = PropertyRef(
|
|
33
|
-
password_reset_required: PropertyRef = PropertyRef(
|
|
34
|
-
multifactor: PropertyRef = PropertyRef(
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
18
|
+
name: PropertyRef = PropertyRef("fullname")
|
|
19
|
+
email: PropertyRef = PropertyRef("username", extra_index=True)
|
|
20
|
+
created: PropertyRef = PropertyRef("created")
|
|
21
|
+
last_pw_change: PropertyRef = PropertyRef("last_pw_change")
|
|
22
|
+
last_login: PropertyRef = PropertyRef("last_login")
|
|
23
|
+
neverloggedin: PropertyRef = PropertyRef("neverloggedin")
|
|
24
|
+
disabled: PropertyRef = PropertyRef("disabled")
|
|
25
|
+
admin: PropertyRef = PropertyRef("admin")
|
|
26
|
+
totalscore: PropertyRef = PropertyRef("totalscore")
|
|
27
|
+
mpstrength: PropertyRef = PropertyRef("mpstrength")
|
|
28
|
+
sites: PropertyRef = PropertyRef("sites")
|
|
29
|
+
notes: PropertyRef = PropertyRef("notes")
|
|
30
|
+
formfills: PropertyRef = PropertyRef("formfills")
|
|
31
|
+
applications: PropertyRef = PropertyRef("applications")
|
|
32
|
+
attachments: PropertyRef = PropertyRef("attachments")
|
|
33
|
+
password_reset_required: PropertyRef = PropertyRef("password_reset_required")
|
|
34
|
+
multifactor: PropertyRef = PropertyRef("multifactor")
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
@dataclass(frozen=True)
|
|
38
38
|
class LastpassUserToHumanRelProperties(CartographyRelProperties):
|
|
39
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
39
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
@dataclass(frozen=True)
|
|
43
43
|
# (:LastpassUser)<-[:IDENTITY_LASTPASS]-(:Human)
|
|
44
44
|
class LastpassHumanToUserRel(CartographyRelSchema):
|
|
45
|
-
target_node_label: str =
|
|
45
|
+
target_node_label: str = "Human"
|
|
46
46
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
47
|
-
{
|
|
47
|
+
{"email": PropertyRef("username")},
|
|
48
48
|
)
|
|
49
49
|
direction: LinkDirection = LinkDirection.INWARD
|
|
50
50
|
rel_label: str = "IDENTITY_LASTPASS"
|
|
@@ -53,24 +53,28 @@ class LastpassHumanToUserRel(CartographyRelSchema):
|
|
|
53
53
|
|
|
54
54
|
@dataclass(frozen=True)
|
|
55
55
|
class LastpassTenantToLastpassUserRelProperties(CartographyRelProperties):
|
|
56
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
56
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
@dataclass(frozen=True)
|
|
60
60
|
# (:LastpassTenant)<-[:RESOURCE]-(:LastpassUser)
|
|
61
61
|
class LastpassTenantToUserRel(CartographyRelSchema):
|
|
62
|
-
target_node_label: str =
|
|
62
|
+
target_node_label: str = "LastpassTenant"
|
|
63
63
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
64
|
-
{
|
|
64
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
65
65
|
)
|
|
66
66
|
direction: LinkDirection = LinkDirection.OUTWARD
|
|
67
67
|
rel_label: str = "RESOURCE"
|
|
68
|
-
properties: LastpassTenantToLastpassUserRelProperties =
|
|
68
|
+
properties: LastpassTenantToLastpassUserRelProperties = (
|
|
69
|
+
LastpassTenantToLastpassUserRelProperties()
|
|
70
|
+
)
|
|
69
71
|
|
|
70
72
|
|
|
71
73
|
@dataclass(frozen=True)
|
|
72
74
|
class LastpassUserSchema(CartographyNodeSchema):
|
|
73
|
-
label: str =
|
|
75
|
+
label: str = "LastpassUser"
|
|
74
76
|
properties: LastpassUserNodeProperties = LastpassUserNodeProperties()
|
|
75
|
-
other_relationships: OtherRelationships = OtherRelationships(
|
|
77
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
78
|
+
rels=[LastpassHumanToUserRel()],
|
|
79
|
+
)
|
|
76
80
|
sub_resource_relationship: LastpassTenantToUserRel = LastpassTenantToUserRel()
|
|
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
|
+
)
|