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
|
@@ -16,18 +16,19 @@ class SnipeitAssetNodeProperties(CartographyNodeProperties):
|
|
|
16
16
|
"""
|
|
17
17
|
https://snipe-it.readme.io/reference/hardware-list
|
|
18
18
|
"""
|
|
19
|
+
|
|
19
20
|
# Common properties
|
|
20
|
-
id: PropertyRef = PropertyRef(
|
|
21
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
21
|
+
id: PropertyRef = PropertyRef("id")
|
|
22
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
22
23
|
|
|
23
24
|
# SnipeIT specific properties
|
|
24
|
-
asset_tag: PropertyRef = PropertyRef(
|
|
25
|
-
assigned_to: PropertyRef = PropertyRef(
|
|
26
|
-
category: PropertyRef = PropertyRef(
|
|
27
|
-
company: PropertyRef = PropertyRef(
|
|
28
|
-
manufacturer: PropertyRef = PropertyRef(
|
|
29
|
-
model: PropertyRef = PropertyRef(
|
|
30
|
-
serial: PropertyRef = PropertyRef(
|
|
25
|
+
asset_tag: PropertyRef = PropertyRef("asset_tag")
|
|
26
|
+
assigned_to: PropertyRef = PropertyRef("assigned_to.email")
|
|
27
|
+
category: PropertyRef = PropertyRef("category.name")
|
|
28
|
+
company: PropertyRef = PropertyRef("company.name")
|
|
29
|
+
manufacturer: PropertyRef = PropertyRef("manufacturer.name")
|
|
30
|
+
model: PropertyRef = PropertyRef("model.name")
|
|
31
|
+
serial: PropertyRef = PropertyRef("serial", extra_index=True)
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
###
|
|
@@ -35,45 +36,53 @@ class SnipeitAssetNodeProperties(CartographyNodeProperties):
|
|
|
35
36
|
###
|
|
36
37
|
@dataclass(frozen=True)
|
|
37
38
|
class SnipeitTenantToSnipeitAssetRelProperties(CartographyRelProperties):
|
|
38
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
39
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
@dataclass(frozen=True)
|
|
42
43
|
class SnipeitTenantToSnipeitAssetRel(CartographyRelSchema):
|
|
43
|
-
target_node_label: str =
|
|
44
|
+
target_node_label: str = "SnipeitTenant"
|
|
44
45
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
45
|
-
{
|
|
46
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
46
47
|
)
|
|
47
48
|
direction: LinkDirection = LinkDirection.INWARD
|
|
48
49
|
rel_label: str = "HAS_ASSET"
|
|
49
|
-
properties: SnipeitTenantToSnipeitAssetRelProperties =
|
|
50
|
+
properties: SnipeitTenantToSnipeitAssetRelProperties = (
|
|
51
|
+
SnipeitTenantToSnipeitAssetRelProperties()
|
|
52
|
+
)
|
|
50
53
|
|
|
51
54
|
|
|
52
55
|
###
|
|
53
56
|
# (:SnipeitUser)-[:HAS_CHECKED_OUT]->(:SnipeitAsset)
|
|
54
57
|
###
|
|
55
58
|
@dataclass(frozen=True)
|
|
56
|
-
class
|
|
57
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
59
|
+
class SnipeitUserToSnipeitAssetRelProperties(CartographyRelProperties):
|
|
60
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
@dataclass(frozen=True)
|
|
61
64
|
class SnipeitUserToSnipeitAssetRel(CartographyRelSchema):
|
|
62
|
-
target_node_label: str =
|
|
65
|
+
target_node_label: str = "SnipeitUser"
|
|
63
66
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
64
|
-
{
|
|
67
|
+
{"email": PropertyRef("assigned_to.email")},
|
|
65
68
|
)
|
|
66
69
|
direction: LinkDirection = LinkDirection.INWARD
|
|
67
70
|
rel_label: str = "HAS_CHECKED_OUT"
|
|
68
|
-
properties:
|
|
71
|
+
properties: SnipeitUserToSnipeitAssetRelProperties = (
|
|
72
|
+
SnipeitUserToSnipeitAssetRelProperties()
|
|
73
|
+
)
|
|
69
74
|
|
|
70
75
|
|
|
71
76
|
###
|
|
72
77
|
@dataclass(frozen=True)
|
|
73
78
|
class SnipeitAssetSchema(CartographyNodeSchema):
|
|
74
|
-
label: str =
|
|
75
|
-
properties: SnipeitAssetNodeProperties =
|
|
76
|
-
|
|
79
|
+
label: str = "SnipeitAsset" # The label of the node
|
|
80
|
+
properties: SnipeitAssetNodeProperties = (
|
|
81
|
+
SnipeitAssetNodeProperties()
|
|
82
|
+
) # An object representing all properties
|
|
83
|
+
sub_resource_relationship: SnipeitTenantToSnipeitAssetRel = (
|
|
84
|
+
SnipeitTenantToSnipeitAssetRel()
|
|
85
|
+
)
|
|
77
86
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
78
87
|
[
|
|
79
88
|
SnipeitUserToSnipeitAssetRel(),
|
|
@@ -7,11 +7,13 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class SnipeitTenantNodeProperties(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 SnipeitTenantSchema(CartographyNodeSchema):
|
|
16
|
-
label: str =
|
|
17
|
-
properties: SnipeitTenantNodeProperties =
|
|
16
|
+
label: str = "SnipeitTenant" # The label of the node
|
|
17
|
+
properties: SnipeitTenantNodeProperties = (
|
|
18
|
+
SnipeitTenantNodeProperties()
|
|
19
|
+
) # An object representing all properties
|
|
@@ -15,35 +15,42 @@ class SnipeitUserNodeProperties(CartographyNodeProperties):
|
|
|
15
15
|
"""
|
|
16
16
|
Ref: https://snipe-it.readme.io/reference/users
|
|
17
17
|
"""
|
|
18
|
+
|
|
18
19
|
# Common properties
|
|
19
|
-
id: PropertyRef = PropertyRef(
|
|
20
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
20
|
+
id: PropertyRef = PropertyRef("id")
|
|
21
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
21
22
|
|
|
22
23
|
# SnipeIT specific properties
|
|
23
|
-
company: PropertyRef = PropertyRef(
|
|
24
|
-
email: PropertyRef = PropertyRef(
|
|
25
|
-
username: PropertyRef = PropertyRef(
|
|
24
|
+
company: PropertyRef = PropertyRef("company_id.name", extra_index=True)
|
|
25
|
+
email: PropertyRef = PropertyRef("email", extra_index=True)
|
|
26
|
+
username: PropertyRef = PropertyRef("username")
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
@dataclass(frozen=True)
|
|
29
30
|
class SnipeitTenantToSnipeitUserRelProperties(CartographyRelProperties):
|
|
30
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
31
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
@dataclass(frozen=True)
|
|
34
35
|
# (:SnipeitTenant)-[:HAS_USER]->(:SnipeitUser)
|
|
35
36
|
class SnipeitTenantToSnipeitUserRel(CartographyRelSchema):
|
|
36
|
-
target_node_label: str =
|
|
37
|
+
target_node_label: str = "SnipeitTenant"
|
|
37
38
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
38
|
-
{
|
|
39
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
39
40
|
)
|
|
40
41
|
direction: LinkDirection = LinkDirection.INWARD
|
|
41
42
|
rel_label: str = "HAS_USER"
|
|
42
|
-
properties: SnipeitTenantToSnipeitUserRelProperties =
|
|
43
|
+
properties: SnipeitTenantToSnipeitUserRelProperties = (
|
|
44
|
+
SnipeitTenantToSnipeitUserRelProperties()
|
|
45
|
+
)
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
@dataclass(frozen=True)
|
|
46
49
|
class SnipeitUserSchema(CartographyNodeSchema):
|
|
47
|
-
label: str =
|
|
48
|
-
properties: SnipeitUserNodeProperties =
|
|
49
|
-
|
|
50
|
+
label: str = "SnipeitUser" # The label of the node
|
|
51
|
+
properties: SnipeitUserNodeProperties = (
|
|
52
|
+
SnipeitUserNodeProperties()
|
|
53
|
+
) # An object representing all properties
|
|
54
|
+
sub_resource_relationship: SnipeitTenantToSnipeitUserRel = (
|
|
55
|
+
SnipeitTenantToSnipeitUserRel()
|
|
56
|
+
)
|
|
File without changes
|
|
@@ -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 TailscaleDeviceNodeProperties(CartographyNodeProperties):
|
|
16
|
+
# We use nodeId because the old property `id` is deprecated
|
|
17
|
+
id: PropertyRef = PropertyRef("nodeId")
|
|
18
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
19
|
+
name: PropertyRef = PropertyRef("name")
|
|
20
|
+
hostname: PropertyRef = PropertyRef("hostname")
|
|
21
|
+
client_version: PropertyRef = PropertyRef("clientVersion")
|
|
22
|
+
update_available: PropertyRef = PropertyRef("updateAvailable")
|
|
23
|
+
os: PropertyRef = PropertyRef("os")
|
|
24
|
+
created: PropertyRef = PropertyRef("created")
|
|
25
|
+
last_seen: PropertyRef = PropertyRef("lastSeen")
|
|
26
|
+
key_expiry_disabled: PropertyRef = PropertyRef("keyExpiryDisabled")
|
|
27
|
+
expires: PropertyRef = PropertyRef("expires")
|
|
28
|
+
authorized: PropertyRef = PropertyRef("authorized")
|
|
29
|
+
is_external: PropertyRef = PropertyRef("isExternal")
|
|
30
|
+
node_key: PropertyRef = PropertyRef("nodeKey")
|
|
31
|
+
blocks_incoming_connections: PropertyRef = PropertyRef("blocksIncomingConnections")
|
|
32
|
+
client_connectivity_endpoints: PropertyRef = PropertyRef(
|
|
33
|
+
"clientConnectivity.endpoints"
|
|
34
|
+
)
|
|
35
|
+
client_connectivity_mapping_varies_by_dest_ip: PropertyRef = PropertyRef(
|
|
36
|
+
"clientConnectivity.mappingVariesByDestIP"
|
|
37
|
+
)
|
|
38
|
+
tailnet_lock_error: PropertyRef = PropertyRef("tailnetLockError")
|
|
39
|
+
tailnet_lock_key: PropertyRef = PropertyRef("tailnetLockKey")
|
|
40
|
+
posture_identity_serial_numbers: PropertyRef = PropertyRef(
|
|
41
|
+
"postureIdentity.serialNumbers"
|
|
42
|
+
)
|
|
43
|
+
posture_identity_disabled: PropertyRef = PropertyRef("postureIdentity.disabled")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class TailscaleDeviceToTailnetRelProperties(CartographyRelProperties):
|
|
48
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(frozen=True)
|
|
52
|
+
# (:TailscaleTailnet)-[:RESOURCE]->(:TailscaleDevice)
|
|
53
|
+
class TailscaleDeviceToTailnetRel(CartographyRelSchema):
|
|
54
|
+
target_node_label: str = "TailscaleTailnet"
|
|
55
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
56
|
+
{"id": PropertyRef("org", set_in_kwargs=True)},
|
|
57
|
+
)
|
|
58
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
59
|
+
rel_label: str = "RESOURCE"
|
|
60
|
+
properties: TailscaleDeviceToTailnetRelProperties = (
|
|
61
|
+
TailscaleDeviceToTailnetRelProperties()
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class TailscaleDeviceToUserRelProperties(CartographyRelProperties):
|
|
67
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True)
|
|
71
|
+
# (:TailscaleUser)-[:OWNS]->(:TailscaleDevice)
|
|
72
|
+
class TailscaleDeviceToUserRel(CartographyRelSchema):
|
|
73
|
+
target_node_label: str = "TailscaleUser"
|
|
74
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
75
|
+
{"login_name": PropertyRef("user")},
|
|
76
|
+
)
|
|
77
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
78
|
+
rel_label: str = "OWNS"
|
|
79
|
+
properties: TailscaleDeviceToUserRelProperties = (
|
|
80
|
+
TailscaleDeviceToUserRelProperties()
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(frozen=True)
|
|
85
|
+
class TailscaleDeviceSchema(CartographyNodeSchema):
|
|
86
|
+
label: str = "TailscaleDevice"
|
|
87
|
+
properties: TailscaleDeviceNodeProperties = TailscaleDeviceNodeProperties()
|
|
88
|
+
sub_resource_relationship: TailscaleDeviceToTailnetRel = (
|
|
89
|
+
TailscaleDeviceToTailnetRel()
|
|
90
|
+
)
|
|
91
|
+
other_relationships = OtherRelationships(
|
|
92
|
+
[
|
|
93
|
+
TailscaleDeviceToUserRel(),
|
|
94
|
+
]
|
|
95
|
+
)
|
|
@@ -0,0 +1,86 @@
|
|
|
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 TailscaleGroupNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
18
|
+
name: PropertyRef = PropertyRef("name")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(frozen=True)
|
|
22
|
+
class TailscaleGroupToTailnetRelProperties(CartographyRelProperties):
|
|
23
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
# (:TailscaleTailnet)-[:RESOURCE]->(:TailscaleGroup)
|
|
28
|
+
class TailscaleGroupToTailnetRel(CartographyRelSchema):
|
|
29
|
+
target_node_label: str = "TailscaleTailnet"
|
|
30
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
31
|
+
{"id": PropertyRef("org", set_in_kwargs=True)},
|
|
32
|
+
)
|
|
33
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
34
|
+
rel_label: str = "RESOURCE"
|
|
35
|
+
properties: TailscaleGroupToTailnetRelProperties = (
|
|
36
|
+
TailscaleGroupToTailnetRelProperties()
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class TailscaleGroupToUserRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
# (:TailscaleUser)-[:MEMBER_OF]->(:TailscaleGroup)
|
|
47
|
+
class TailscaleGroupToUserRel(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = "TailscaleUser"
|
|
49
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
+
{"login_name": PropertyRef("members", one_to_many=True)},
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
53
|
+
rel_label: str = "MEMBER_OF"
|
|
54
|
+
properties: TailscaleGroupToUserRelProperties = TailscaleGroupToUserRelProperties()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class TailscaleGroupToGroupRelProperties(CartographyRelProperties):
|
|
59
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
# (:TailscaleGroup)-[:MEMBER_OF]->(:TailscaleGroup)
|
|
64
|
+
class TailscaleGroupToGroupRel(CartographyRelSchema):
|
|
65
|
+
target_node_label: str = "TailscaleGroup"
|
|
66
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
+
{"id": PropertyRef("sub_groups", one_to_many=True)},
|
|
68
|
+
)
|
|
69
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
70
|
+
rel_label: str = "MEMBER_OF"
|
|
71
|
+
properties: TailscaleGroupToGroupRelProperties = (
|
|
72
|
+
TailscaleGroupToGroupRelProperties()
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass(frozen=True)
|
|
77
|
+
class TailscaleGroupSchema(CartographyNodeSchema):
|
|
78
|
+
label: str = "TailscaleGroup"
|
|
79
|
+
properties: TailscaleGroupNodeProperties = TailscaleGroupNodeProperties()
|
|
80
|
+
sub_resource_relationship: TailscaleGroupToTailnetRel = TailscaleGroupToTailnetRel()
|
|
81
|
+
other_relationships = OtherRelationships(
|
|
82
|
+
[
|
|
83
|
+
TailscaleGroupToGroupRel(),
|
|
84
|
+
TailscaleGroupToUserRel(),
|
|
85
|
+
]
|
|
86
|
+
)
|
|
@@ -0,0 +1,58 @@
|
|
|
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 TailscalePostureIntegrationNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
provider: PropertyRef = PropertyRef("provider")
|
|
18
|
+
cloud_id: PropertyRef = PropertyRef("cloudId")
|
|
19
|
+
client_id: PropertyRef = PropertyRef("clientId")
|
|
20
|
+
tenant_id: PropertyRef = PropertyRef("tenantId")
|
|
21
|
+
config_updated: PropertyRef = PropertyRef("configUpdated")
|
|
22
|
+
status_last_sync: PropertyRef = PropertyRef("status.lastSync")
|
|
23
|
+
status_error: PropertyRef = PropertyRef("status.error")
|
|
24
|
+
status_provider_host_count: PropertyRef = PropertyRef("status.providerHostCount")
|
|
25
|
+
status_matched_count: PropertyRef = PropertyRef("status.matchedCount")
|
|
26
|
+
status_possible_matched_count: PropertyRef = PropertyRef(
|
|
27
|
+
"status.possibleMatchedCount"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class TailscalePostureIntegrationToTailnetRelProperties(CartographyRelProperties):
|
|
33
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
# (:TailscaleTailnet)-[:RESOURCE]->(:TailscalePostureIntegration)
|
|
38
|
+
class TailscalePostureIntegrationToTailnetRel(CartographyRelSchema):
|
|
39
|
+
target_node_label: str = "TailscaleTailnet"
|
|
40
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
41
|
+
{"id": PropertyRef("org", set_in_kwargs=True)},
|
|
42
|
+
)
|
|
43
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
44
|
+
rel_label: str = "RESOURCE"
|
|
45
|
+
properties: TailscalePostureIntegrationToTailnetRelProperties = (
|
|
46
|
+
TailscalePostureIntegrationToTailnetRelProperties()
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class TailscalePostureIntegrationSchema(CartographyNodeSchema):
|
|
52
|
+
label: str = "TailscalePostureIntegration"
|
|
53
|
+
properties: TailscalePostureIntegrationNodeProperties = (
|
|
54
|
+
TailscalePostureIntegrationNodeProperties()
|
|
55
|
+
)
|
|
56
|
+
sub_resource_relationship: TailscalePostureIntegrationToTailnetRel = (
|
|
57
|
+
TailscalePostureIntegrationToTailnetRel()
|
|
58
|
+
)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.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 TailscaleTagNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
18
|
+
name: PropertyRef = PropertyRef("name")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(frozen=True)
|
|
22
|
+
class TailscaleTagToTailnetRelProperties(CartographyRelProperties):
|
|
23
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
# (:TailscaleTailnet)-[:RESOURCE]->(:TailscaleTag)
|
|
28
|
+
class TailscaleTagToTailnetRel(CartographyRelSchema):
|
|
29
|
+
target_node_label: str = "TailscaleTailnet"
|
|
30
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
31
|
+
{"id": PropertyRef("org", set_in_kwargs=True)},
|
|
32
|
+
)
|
|
33
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
34
|
+
rel_label: str = "RESOURCE"
|
|
35
|
+
properties: TailscaleTagToTailnetRelProperties = (
|
|
36
|
+
TailscaleTagToTailnetRelProperties()
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class TailscaleTagToUserRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
# (:TailscaleUser)-[:OWNS]->(:TailscaleTag)
|
|
47
|
+
class TailscaleTagToUserRel(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = "TailscaleUser"
|
|
49
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
+
{"login_name": PropertyRef("owners", one_to_many=True)},
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
53
|
+
rel_label: str = "OWNS"
|
|
54
|
+
properties: TailscaleTagToUserRelProperties = TailscaleTagToUserRelProperties()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class TailscaleTagToGroupRelProperties(CartographyRelProperties):
|
|
59
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
# (:TailscaleGroup)-[:OWNS]->(:TailscaleTag)
|
|
64
|
+
class TailscaleTagToGroupRel(CartographyRelSchema):
|
|
65
|
+
target_node_label: str = "TailscaleGroup"
|
|
66
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
+
{"id": PropertyRef("group_owners", one_to_many=True)},
|
|
68
|
+
)
|
|
69
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
70
|
+
rel_label: str = "OWNS"
|
|
71
|
+
properties: TailscaleTagToGroupRelProperties = TailscaleTagToGroupRelProperties()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class TailscaleTagToDeviceRelProperties(CartographyRelProperties):
|
|
76
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
# (:TailscaleDevice)-[:TAGGED]->(:TailscaleTag)
|
|
81
|
+
class TailscaleTagToDeviceRel(CartographyRelSchema):
|
|
82
|
+
target_node_label: str = "TailscaleDevice"
|
|
83
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
84
|
+
{"id": PropertyRef("devices", one_to_many=True)},
|
|
85
|
+
)
|
|
86
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
87
|
+
rel_label: str = "TAGGED"
|
|
88
|
+
properties: TailscaleTagToDeviceRelProperties = TailscaleTagToDeviceRelProperties()
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@dataclass(frozen=True)
|
|
92
|
+
class TailscaleTagSchema(CartographyNodeSchema):
|
|
93
|
+
label: str = "TailscaleTag"
|
|
94
|
+
properties: TailscaleTagNodeProperties = TailscaleTagNodeProperties()
|
|
95
|
+
sub_resource_relationship: TailscaleTagToTailnetRel = TailscaleTagToTailnetRel()
|
|
96
|
+
other_relationships = OtherRelationships(
|
|
97
|
+
[
|
|
98
|
+
TailscaleTagToGroupRel(),
|
|
99
|
+
TailscaleTagToUserRel(),
|
|
100
|
+
TailscaleTagToDeviceRel(),
|
|
101
|
+
]
|
|
102
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
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 TailscaleTailnetNodeProperties(CartographyNodeProperties):
|
|
10
|
+
id: PropertyRef = PropertyRef("org", set_in_kwargs=True)
|
|
11
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
12
|
+
devices_approval_on: PropertyRef = PropertyRef("devicesApprovalOn")
|
|
13
|
+
devices_auto_updates_on: PropertyRef = PropertyRef("devicesAutoUpdatesOn")
|
|
14
|
+
devices_key_duration_days: PropertyRef = PropertyRef("devicesKeyDurationDays")
|
|
15
|
+
users_approval_on: PropertyRef = PropertyRef("usersApprovalOn")
|
|
16
|
+
users_role_allowed_to_join_external_tailnets: PropertyRef = PropertyRef(
|
|
17
|
+
"usersRoleAllowedToJoinExternalTailnets"
|
|
18
|
+
)
|
|
19
|
+
network_flow_logging_on: PropertyRef = PropertyRef("networkFlowLoggingOn")
|
|
20
|
+
regional_routing_on: PropertyRef = PropertyRef("regionalRoutingOn")
|
|
21
|
+
posture_identity_collection_on: PropertyRef = PropertyRef(
|
|
22
|
+
"postureIdentityCollectionOn"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class TailscaleTailnetSchema(CartographyNodeSchema):
|
|
28
|
+
label: str = "TailscaleTailnet"
|
|
29
|
+
properties: TailscaleTailnetNodeProperties = TailscaleTailnetNodeProperties()
|
|
@@ -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 TailscaleUserNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
display_name: PropertyRef = PropertyRef("displayName")
|
|
18
|
+
login_name: PropertyRef = PropertyRef("loginName", extra_index=True)
|
|
19
|
+
profile_pic_url: PropertyRef = PropertyRef("profilePicUrl")
|
|
20
|
+
created: PropertyRef = PropertyRef("created")
|
|
21
|
+
type: PropertyRef = PropertyRef("type")
|
|
22
|
+
role: PropertyRef = PropertyRef("role")
|
|
23
|
+
status: PropertyRef = PropertyRef("status")
|
|
24
|
+
device_count: PropertyRef = PropertyRef("deviceCount")
|
|
25
|
+
last_seen: PropertyRef = PropertyRef("lastSeen")
|
|
26
|
+
currently_connected: PropertyRef = PropertyRef("currentlyConnected")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class TailscaleUserToTailnetRelProperties(CartographyRelProperties):
|
|
31
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass(frozen=True)
|
|
35
|
+
# (:TailscaleTailnet)-[:RESOURCE]->(:TailscaleUser)
|
|
36
|
+
class TailscaleUserToTailnetRel(CartographyRelSchema):
|
|
37
|
+
target_node_label: str = "TailscaleTailnet"
|
|
38
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
39
|
+
{"id": PropertyRef("org", set_in_kwargs=True)},
|
|
40
|
+
)
|
|
41
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
42
|
+
rel_label: str = "RESOURCE"
|
|
43
|
+
properties: TailscaleUserToTailnetRelProperties = (
|
|
44
|
+
TailscaleUserToTailnetRelProperties()
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True)
|
|
49
|
+
class TailscaleUserSchema(CartographyNodeSchema):
|
|
50
|
+
label: str = "TailscaleUser"
|
|
51
|
+
properties: TailscaleUserNodeProperties = TailscaleUserNodeProperties()
|
|
52
|
+
sub_resource_relationship: TailscaleUserToTailnetRel = TailscaleUserToTailnetRel()
|
cartography/stats.py
CHANGED
|
@@ -17,11 +17,11 @@ class ScopedStatsClient:
|
|
|
17
17
|
|
|
18
18
|
_client: StatsClient = None
|
|
19
19
|
|
|
20
|
-
def __init__(self, prefix: Optional[str], root:
|
|
20
|
+
def __init__(self, prefix: Optional[str], root: "ScopedStatsClient"):
|
|
21
21
|
self._scope_prefix = prefix
|
|
22
22
|
self._root = root
|
|
23
23
|
|
|
24
|
-
def get_stats_client(self, scope: str) ->
|
|
24
|
+
def get_stats_client(self, scope: str) -> "ScopedStatsClient":
|
|
25
25
|
"""
|
|
26
26
|
This method returns a new proxy to the same client
|
|
27
27
|
which will prefix all calls to underlying methods with the scoped prefix
|
|
@@ -35,7 +35,7 @@ class ScopedStatsClient:
|
|
|
35
35
|
return scoped_stats_client
|
|
36
36
|
|
|
37
37
|
@staticmethod
|
|
38
|
-
def get_root_client() ->
|
|
38
|
+
def get_root_client() -> "ScopedStatsClient":
|
|
39
39
|
client = ScopedStatsClient(prefix=None, root=None) # type: ignore
|
|
40
40
|
client._root = client
|
|
41
41
|
return client
|