cartography 0.102.0rc2__py3-none-any.whl → 0.103.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.
- cartography/__main__.py +1 -2
- cartography/_version.py +2 -2
- cartography/cli.py +302 -253
- cartography/client/core/tx.py +39 -18
- cartography/config.py +4 -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/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/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 +53 -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/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/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/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/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/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/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/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/stats.py +3 -3
- cartography/sync.py +107 -31
- cartography/util.py +84 -62
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0rc1.dist-info}/METADATA +3 -14
- cartography-0.103.0rc1.dist-info/RECORD +396 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0rc1.dist-info}/WHEEL +1 -1
- cartography-0.102.0rc2.dist-info/RECORD +0 -381
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0rc1.dist-info}/entry_points.txt +0 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0rc1.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.102.0rc2.dist-info → cartography-0.103.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -12,58 +12,62 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
12
12
|
|
|
13
13
|
@dataclass(frozen=True)
|
|
14
14
|
class BigfixComputerNodeProperties(CartographyNodeProperties):
|
|
15
|
-
id: PropertyRef = PropertyRef(
|
|
16
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
17
|
-
activedirectorypath: PropertyRef = PropertyRef(
|
|
18
|
-
agenttype: PropertyRef = PropertyRef(
|
|
19
|
-
agentversion: PropertyRef = PropertyRef(
|
|
20
|
-
averageevaluationcycle: PropertyRef = PropertyRef(
|
|
21
|
-
besrelayselectionmethod: PropertyRef = PropertyRef(
|
|
22
|
-
besrootserver: PropertyRef = PropertyRef(
|
|
23
|
-
bios: PropertyRef = PropertyRef(
|
|
24
|
-
computertype: PropertyRef = PropertyRef(
|
|
25
|
-
computername: PropertyRef = PropertyRef(
|
|
26
|
-
cpu: PropertyRef = PropertyRef(
|
|
27
|
-
devicetype: PropertyRef = PropertyRef(
|
|
28
|
-
distancetobesrelay: PropertyRef = PropertyRef(
|
|
29
|
-
dnsname: PropertyRef = PropertyRef(
|
|
30
|
-
enrollmentdatetime: PropertyRef = PropertyRef(
|
|
31
|
-
freespaceonsystemdrive: PropertyRef = PropertyRef(
|
|
32
|
-
ipaddress: PropertyRef = PropertyRef(
|
|
33
|
-
ipv6address: PropertyRef = PropertyRef(
|
|
34
|
-
islocked: PropertyRef = PropertyRef(
|
|
35
|
-
lastreporttime: PropertyRef = PropertyRef(
|
|
36
|
-
locationbyiprange: PropertyRef = PropertyRef(
|
|
37
|
-
loggedonuser: PropertyRef = PropertyRef(
|
|
38
|
-
macaddress: PropertyRef = PropertyRef(
|
|
39
|
-
os: PropertyRef = PropertyRef(
|
|
40
|
-
providername: PropertyRef = PropertyRef(
|
|
41
|
-
ram: PropertyRef = PropertyRef(
|
|
42
|
-
relay: PropertyRef = PropertyRef(
|
|
43
|
-
remotedesktopisenabled: PropertyRef = PropertyRef(
|
|
44
|
-
subnetaddress: PropertyRef = PropertyRef(
|
|
45
|
-
totalsizeofsystemdrive: PropertyRef = PropertyRef(
|
|
46
|
-
username: PropertyRef = PropertyRef(
|
|
15
|
+
id: PropertyRef = PropertyRef("ID")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
activedirectorypath: PropertyRef = PropertyRef("ActiveDirectoryPath")
|
|
18
|
+
agenttype: PropertyRef = PropertyRef("AgentType")
|
|
19
|
+
agentversion: PropertyRef = PropertyRef("AgentVersion")
|
|
20
|
+
averageevaluationcycle: PropertyRef = PropertyRef("AverageEvaluationCycle")
|
|
21
|
+
besrelayselectionmethod: PropertyRef = PropertyRef("BESRelaySelectionMethod")
|
|
22
|
+
besrootserver: PropertyRef = PropertyRef("BESRootServer")
|
|
23
|
+
bios: PropertyRef = PropertyRef("BIOS")
|
|
24
|
+
computertype: PropertyRef = PropertyRef("ComputerType")
|
|
25
|
+
computername: PropertyRef = PropertyRef("ComputerName")
|
|
26
|
+
cpu: PropertyRef = PropertyRef("CPU")
|
|
27
|
+
devicetype: PropertyRef = PropertyRef("DeviceType")
|
|
28
|
+
distancetobesrelay: PropertyRef = PropertyRef("DistanceToBESRelay")
|
|
29
|
+
dnsname: PropertyRef = PropertyRef("DNSName")
|
|
30
|
+
enrollmentdatetime: PropertyRef = PropertyRef("EnrollmentDateTime")
|
|
31
|
+
freespaceonsystemdrive: PropertyRef = PropertyRef("FreeSpaceOnSystemDrive")
|
|
32
|
+
ipaddress: PropertyRef = PropertyRef("IPAddress")
|
|
33
|
+
ipv6address: PropertyRef = PropertyRef("IPv6Address")
|
|
34
|
+
islocked: PropertyRef = PropertyRef("IsLocked")
|
|
35
|
+
lastreporttime: PropertyRef = PropertyRef("LastReportDateTime")
|
|
36
|
+
locationbyiprange: PropertyRef = PropertyRef("LocationByIPRange")
|
|
37
|
+
loggedonuser: PropertyRef = PropertyRef("LoggedonUser")
|
|
38
|
+
macaddress: PropertyRef = PropertyRef("MACAddress")
|
|
39
|
+
os: PropertyRef = PropertyRef("OS")
|
|
40
|
+
providername: PropertyRef = PropertyRef("ProviderName")
|
|
41
|
+
ram: PropertyRef = PropertyRef("RAM")
|
|
42
|
+
relay: PropertyRef = PropertyRef("Relay")
|
|
43
|
+
remotedesktopisenabled: PropertyRef = PropertyRef("RemoteDesktopIsEnabled")
|
|
44
|
+
subnetaddress: PropertyRef = PropertyRef("SubnetAddress")
|
|
45
|
+
totalsizeofsystemdrive: PropertyRef = PropertyRef("TotalSizeOfSystemDrive")
|
|
46
|
+
username: PropertyRef = PropertyRef("UserName")
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
@dataclass(frozen=True)
|
|
50
50
|
class BigfixComputerToBigfixRootRelProperties(CartographyRelProperties):
|
|
51
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
51
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
@dataclass(frozen=True)
|
|
55
55
|
class BigfixComputerToBigfixRootRel(CartographyRelSchema):
|
|
56
|
-
target_node_label: str =
|
|
56
|
+
target_node_label: str = "BigfixRoot"
|
|
57
57
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
58
|
-
{
|
|
58
|
+
{"id": PropertyRef("ROOT_URL", set_in_kwargs=True)},
|
|
59
59
|
)
|
|
60
60
|
direction: LinkDirection = LinkDirection.INWARD
|
|
61
61
|
rel_label: str = "RESOURCE"
|
|
62
|
-
properties: BigfixComputerToBigfixRootRelProperties =
|
|
62
|
+
properties: BigfixComputerToBigfixRootRelProperties = (
|
|
63
|
+
BigfixComputerToBigfixRootRelProperties()
|
|
64
|
+
)
|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
@dataclass(frozen=True)
|
|
66
68
|
class BigfixComputerSchema(CartographyNodeSchema):
|
|
67
|
-
label: str =
|
|
69
|
+
label: str = "BigfixComputer"
|
|
68
70
|
properties: BigfixComputerNodeProperties = BigfixComputerNodeProperties()
|
|
69
|
-
sub_resource_relationship: BigfixComputerToBigfixRootRel =
|
|
71
|
+
sub_resource_relationship: BigfixComputerToBigfixRootRel = (
|
|
72
|
+
BigfixComputerToBigfixRootRel()
|
|
73
|
+
)
|
|
@@ -7,11 +7,11 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class BigfixRootNodeProperties(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 BigfixRootSchema(CartographyNodeSchema):
|
|
16
|
-
label: str =
|
|
16
|
+
label: str = "BigfixRoot"
|
|
17
17
|
properties: BigfixRootNodeProperties = BigfixRootNodeProperties()
|
|
@@ -9,13 +9,13 @@ class PropertyRef:
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
def __init__(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
self,
|
|
13
|
+
name: str,
|
|
14
|
+
set_in_kwargs=False,
|
|
15
|
+
extra_index=False,
|
|
16
|
+
ignore_case=False,
|
|
17
|
+
fuzzy_and_ignore_case=False,
|
|
18
|
+
one_to_many=False,
|
|
19
19
|
):
|
|
20
20
|
"""
|
|
21
21
|
:param name: The name of the property
|
|
@@ -74,13 +74,13 @@ class PropertyRef:
|
|
|
74
74
|
if self.fuzzy_and_ignore_case and self.ignore_case:
|
|
75
75
|
raise ValueError(
|
|
76
76
|
f'Error setting PropertyRef "{self.name}": ignore_case cannot be used together with'
|
|
77
|
-
|
|
77
|
+
"fuzzy_and_ignore_case. Pick one or the other.",
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
if self.one_to_many and (self.ignore_case or self.fuzzy_and_ignore_case):
|
|
81
81
|
raise ValueError(
|
|
82
82
|
f'Error setting PropertyRef "{self.name}": one_to_many cannot be used together with '
|
|
83
|
-
|
|
83
|
+
"`ignore_case` or `fuzzy_and_ignore_case`.",
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
def _parameterize_name(self) -> str:
|
|
@@ -103,4 +103,6 @@ class PropertyRef:
|
|
|
103
103
|
querybuilder.build_ingestion_query(). This is used for things like applying the same update tag to all nodes of
|
|
104
104
|
a given run.
|
|
105
105
|
"""
|
|
106
|
-
return
|
|
106
|
+
return (
|
|
107
|
+
f"item.{self.name}" if not self.set_in_kwargs else self._parameterize_name()
|
|
108
|
+
)
|
cartography/models/core/nodes.py
CHANGED
|
@@ -16,6 +16,7 @@ class CartographyNodeProperties(abc.ABC):
|
|
|
16
16
|
can enforce that all subclasses have an id and a lastupdated field. These fields are assigned to the node in the
|
|
17
17
|
`SET` clause.
|
|
18
18
|
"""
|
|
19
|
+
|
|
19
20
|
id: PropertyRef = field(init=False)
|
|
20
21
|
lastupdated: PropertyRef = field(init=False)
|
|
21
22
|
|
|
@@ -24,12 +25,12 @@ class CartographyNodeProperties(abc.ABC):
|
|
|
24
25
|
Data validation.
|
|
25
26
|
1. Prevents direct instantiation. This workaround is needed since this is a dataclass and an abstract
|
|
26
27
|
class without an abstract method defined. See https://stackoverflow.com/q/60590442.
|
|
27
|
-
2. Stops reserved words from being used as attribute names. See https://github.com/
|
|
28
|
+
2. Stops reserved words from being used as attribute names. See https://github.com/cartography-cncf/cartography/issues/1064.
|
|
28
29
|
"""
|
|
29
30
|
if self.__class__ == CartographyNodeProperties:
|
|
30
31
|
raise TypeError("Cannot instantiate abstract class.")
|
|
31
32
|
|
|
32
|
-
if hasattr(self,
|
|
33
|
+
if hasattr(self, "firstseen"):
|
|
33
34
|
raise TypeError(
|
|
34
35
|
"`firstseen` is a reserved word and is automatically set by the querybuilder on cartography nodes, so "
|
|
35
36
|
f'it cannot be used on class "{type(self).__name__}(CartographyNodeProperties)". Please either choose '
|
|
@@ -43,6 +44,7 @@ class ExtraNodeLabels:
|
|
|
43
44
|
Encapsulates a list of str representing additional labels for the CartographyNodeSchema that this is composed on.
|
|
44
45
|
This wrapping is used to ensure dataclass immutability for the CartographyNodeSchema.
|
|
45
46
|
"""
|
|
47
|
+
|
|
46
48
|
labels: List[str]
|
|
47
49
|
|
|
48
50
|
|
|
@@ -52,6 +54,7 @@ class CartographyNodeSchema(abc.ABC):
|
|
|
52
54
|
Abstract base dataclass that represents a graph node in cartography. This is used to dynamically generate graph
|
|
53
55
|
ingestion queries.
|
|
54
56
|
"""
|
|
57
|
+
|
|
55
58
|
@property
|
|
56
59
|
@abc.abstractmethod
|
|
57
60
|
def label(self) -> str:
|
|
@@ -19,18 +19,19 @@ class LinkDirection(Enum):
|
|
|
19
19
|
|
|
20
20
|
class EMRCluster(CartographyNodeSchema):
|
|
21
21
|
label: str = "EMRCluster"
|
|
22
|
-
sub_resource_relationship: CartographyRelSchema =
|
|
22
|
+
sub_resource_relationship: CartographyRelSchema = EMRClusterToAWSAccountRel()
|
|
23
23
|
# ...
|
|
24
24
|
|
|
25
|
-
class
|
|
25
|
+
class EMRClusterToAWSAccountRel(CartographyRelSchema):
|
|
26
26
|
target_node_label: str = "AWSAccount"
|
|
27
27
|
rel_label: str = "RESOURCE"
|
|
28
28
|
direction: LinkDirection = LinkDirection.INWARD
|
|
29
29
|
# ...
|
|
30
30
|
|
|
31
|
-
If `
|
|
31
|
+
If `EMRClusterToAWSAccountRel.direction` was LinkDirection.OUTWARD, then the directionality of the relationship would
|
|
32
32
|
be `(:EMRCluster)-[:RESOURCE]->(:AWSAccount)` instead.
|
|
33
33
|
"""
|
|
34
|
+
|
|
34
35
|
INWARD = auto()
|
|
35
36
|
OUTWARD = auto()
|
|
36
37
|
|
|
@@ -42,6 +43,7 @@ class CartographyRelProperties(abc.ABC):
|
|
|
42
43
|
subclasses will have a lastupdated field defined on their resulting relationships. These fields are assigned to the
|
|
43
44
|
relationship in the `SET` clause.
|
|
44
45
|
"""
|
|
46
|
+
|
|
45
47
|
lastupdated: PropertyRef = field(init=False)
|
|
46
48
|
|
|
47
49
|
def __post_init__(self):
|
|
@@ -49,12 +51,12 @@ class CartographyRelProperties(abc.ABC):
|
|
|
49
51
|
Data validation.
|
|
50
52
|
1. Prevents direct instantiation. This workaround is needed since this is a dataclass and an abstract
|
|
51
53
|
class without an abstract method defined. See https://stackoverflow.com/q/60590442.
|
|
52
|
-
2. Stops reserved words from being used as attribute names. See https://github.com/
|
|
54
|
+
2. Stops reserved words from being used as attribute names. See https://github.com/cartography-cncf/cartography/issues/1064.
|
|
53
55
|
"""
|
|
54
56
|
if self.__class__ == CartographyRelProperties:
|
|
55
57
|
raise TypeError("Cannot instantiate abstract class.")
|
|
56
58
|
|
|
57
|
-
if hasattr(self,
|
|
59
|
+
if hasattr(self, "firstseen"):
|
|
58
60
|
raise TypeError(
|
|
59
61
|
"`firstseen` is a reserved word and is automatically set by the querybuilder on cartography rels, so "
|
|
60
62
|
f'it cannot be used on class "{type(self).__name__}(CartographyRelProperties)". Please either choose '
|
|
@@ -72,6 +74,7 @@ class TargetNodeMatcher:
|
|
|
72
74
|
This is used to ensure dataclass immutability when composed as part of a CartographyNodeSchema object.
|
|
73
75
|
See `make_target_node_matcher()`.
|
|
74
76
|
"""
|
|
77
|
+
|
|
75
78
|
pass
|
|
76
79
|
|
|
77
80
|
|
|
@@ -80,7 +83,10 @@ def make_target_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> TargetNode
|
|
|
80
83
|
:param key_ref_dict: A Dict mapping keys present on the node to PropertyRef objects.
|
|
81
84
|
:return: A TargetNodeMatcher used for CartographyRelSchema to match with other nodes.
|
|
82
85
|
"""
|
|
83
|
-
fields = [
|
|
86
|
+
fields = [
|
|
87
|
+
(key, PropertyRef, field(default=prop_ref))
|
|
88
|
+
for key, prop_ref in key_ref_dict.items()
|
|
89
|
+
]
|
|
84
90
|
return make_dataclass(TargetNodeMatcher.__name__, fields, frozen=True)()
|
|
85
91
|
|
|
86
92
|
|
|
@@ -92,6 +98,7 @@ class CartographyRelSchema(abc.ABC):
|
|
|
92
98
|
The CartographyRelSchema contains properties that make it possible to connect the CartographyNodeSchema to other
|
|
93
99
|
existing nodes in the graph.
|
|
94
100
|
"""
|
|
101
|
+
|
|
95
102
|
@property
|
|
96
103
|
@abc.abstractmethod
|
|
97
104
|
def properties(self) -> CartographyRelProperties:
|
|
@@ -139,4 +146,5 @@ class OtherRelationships:
|
|
|
139
146
|
Encapsulates a list of CartographyRelSchema. This is used to ensure dataclass immutability when composed as part of
|
|
140
147
|
a CartographyNodeSchema object.
|
|
141
148
|
"""
|
|
149
|
+
|
|
142
150
|
rels: List[CartographyRelSchema]
|
|
@@ -7,43 +7,45 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class CrowdstrikeHostNodeProperties(CartographyNodeProperties):
|
|
10
|
-
id: PropertyRef = PropertyRef(
|
|
11
|
-
cid: PropertyRef = PropertyRef(
|
|
12
|
-
instance_id: PropertyRef = PropertyRef(
|
|
13
|
-
serial_number: PropertyRef = PropertyRef(
|
|
14
|
-
status: PropertyRef = PropertyRef(
|
|
15
|
-
hostname: PropertyRef = PropertyRef(
|
|
16
|
-
machine_domain: PropertyRef = PropertyRef(
|
|
17
|
-
crowdstrike_first_seen: PropertyRef = PropertyRef(
|
|
18
|
-
crowdstrike_last_seen: PropertyRef = PropertyRef(
|
|
19
|
-
local_ip: PropertyRef = PropertyRef(
|
|
20
|
-
external_ip: PropertyRef = PropertyRef(
|
|
21
|
-
cpu_signature: PropertyRef = PropertyRef(
|
|
22
|
-
bios_manufacturer: PropertyRef = PropertyRef(
|
|
23
|
-
bios_version: PropertyRef = PropertyRef(
|
|
24
|
-
mac_address: PropertyRef = PropertyRef(
|
|
25
|
-
os_version: PropertyRef = PropertyRef(
|
|
26
|
-
os_build: PropertyRef = PropertyRef(
|
|
27
|
-
platform_id: PropertyRef = PropertyRef(
|
|
28
|
-
platform_name: PropertyRef = PropertyRef(
|
|
29
|
-
service_provider: PropertyRef = PropertyRef(
|
|
30
|
-
service_provider_account_id: PropertyRef = PropertyRef(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
id: PropertyRef = PropertyRef("device_id")
|
|
11
|
+
cid: PropertyRef = PropertyRef("cid")
|
|
12
|
+
instance_id: PropertyRef = PropertyRef("instance_id", extra_index=True)
|
|
13
|
+
serial_number: PropertyRef = PropertyRef("serial_number", extra_index=True)
|
|
14
|
+
status: PropertyRef = PropertyRef("status")
|
|
15
|
+
hostname: PropertyRef = PropertyRef("hostname")
|
|
16
|
+
machine_domain: PropertyRef = PropertyRef("machine_domain")
|
|
17
|
+
crowdstrike_first_seen: PropertyRef = PropertyRef("first_seen")
|
|
18
|
+
crowdstrike_last_seen: PropertyRef = PropertyRef("last_seen")
|
|
19
|
+
local_ip: PropertyRef = PropertyRef("local_ip")
|
|
20
|
+
external_ip: PropertyRef = PropertyRef("external_ip")
|
|
21
|
+
cpu_signature: PropertyRef = PropertyRef("cpu_signature")
|
|
22
|
+
bios_manufacturer: PropertyRef = PropertyRef("bios_manufacturer")
|
|
23
|
+
bios_version: PropertyRef = PropertyRef("bios_version")
|
|
24
|
+
mac_address: PropertyRef = PropertyRef("mac_address")
|
|
25
|
+
os_version: PropertyRef = PropertyRef("os_version")
|
|
26
|
+
os_build: PropertyRef = PropertyRef("os_build")
|
|
27
|
+
platform_id: PropertyRef = PropertyRef("platform_id")
|
|
28
|
+
platform_name: PropertyRef = PropertyRef("platform_name")
|
|
29
|
+
service_provider: PropertyRef = PropertyRef("service_provider")
|
|
30
|
+
service_provider_account_id: PropertyRef = PropertyRef(
|
|
31
|
+
"service_provider_account_id"
|
|
32
|
+
)
|
|
33
|
+
agent_version: PropertyRef = PropertyRef("agent_version")
|
|
34
|
+
system_manufacturer: PropertyRef = PropertyRef("system_manufacturer")
|
|
35
|
+
system_product_name: PropertyRef = PropertyRef("system_product_name")
|
|
36
|
+
product_type: PropertyRef = PropertyRef("product_type")
|
|
37
|
+
product_type_desc: PropertyRef = PropertyRef("product_type_desc")
|
|
38
|
+
provision_status: PropertyRef = PropertyRef("provision_status")
|
|
39
|
+
reduced_functionality_mode: PropertyRef = PropertyRef("reduced_functionality_mode")
|
|
40
|
+
kernel_version: PropertyRef = PropertyRef("kernel_version")
|
|
41
|
+
major_version: PropertyRef = PropertyRef("major_version")
|
|
42
|
+
minor_version: PropertyRef = PropertyRef("minor_version")
|
|
43
|
+
tags: PropertyRef = PropertyRef("tags")
|
|
44
|
+
modified_timestamp: PropertyRef = PropertyRef("modified_timestamp")
|
|
45
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
@dataclass(frozen=True)
|
|
47
49
|
class CrowdstrikeHostSchema(CartographyNodeSchema):
|
|
48
|
-
label: str =
|
|
50
|
+
label: str = "CrowdstrikeHost"
|
|
49
51
|
properties: CrowdstrikeHostNodeProperties = CrowdstrikeHostNodeProperties()
|
cartography/models/cve/cve.py
CHANGED
|
@@ -13,41 +13,41 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True)
|
|
15
15
|
class CVENodeProperties(CartographyNodeProperties):
|
|
16
|
-
id: PropertyRef = PropertyRef(
|
|
17
|
-
assigner: PropertyRef = PropertyRef(
|
|
18
|
-
description: PropertyRef = PropertyRef(
|
|
19
|
-
references: PropertyRef = PropertyRef(
|
|
20
|
-
problem_types: PropertyRef = PropertyRef(
|
|
21
|
-
vector_string: PropertyRef = PropertyRef(
|
|
22
|
-
attack_vector: PropertyRef = PropertyRef(
|
|
23
|
-
attack_complexity: PropertyRef = PropertyRef(
|
|
24
|
-
privileges_required: PropertyRef = PropertyRef(
|
|
25
|
-
user_interaction: PropertyRef = PropertyRef(
|
|
26
|
-
scope: PropertyRef = PropertyRef(
|
|
27
|
-
confidentiality_impact: PropertyRef = PropertyRef(
|
|
28
|
-
integrity_impact: PropertyRef = PropertyRef(
|
|
29
|
-
availability_impact: PropertyRef = PropertyRef(
|
|
30
|
-
base_score: PropertyRef = PropertyRef(
|
|
31
|
-
base_severity: PropertyRef = PropertyRef(
|
|
32
|
-
exploitability_score: PropertyRef = PropertyRef(
|
|
33
|
-
impact_score: PropertyRef = PropertyRef(
|
|
34
|
-
published_date: PropertyRef = PropertyRef(
|
|
35
|
-
last_modified_date: PropertyRef = PropertyRef(
|
|
36
|
-
vuln_status: PropertyRef = PropertyRef(
|
|
37
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
assigner: PropertyRef = PropertyRef("sourceIdentifier")
|
|
18
|
+
description: PropertyRef = PropertyRef("descriptions_en")
|
|
19
|
+
references: PropertyRef = PropertyRef("references_urls")
|
|
20
|
+
problem_types: PropertyRef = PropertyRef("weaknesses")
|
|
21
|
+
vector_string: PropertyRef = PropertyRef("vectorString")
|
|
22
|
+
attack_vector: PropertyRef = PropertyRef("attackVector")
|
|
23
|
+
attack_complexity: PropertyRef = PropertyRef("attackComplexity")
|
|
24
|
+
privileges_required: PropertyRef = PropertyRef("privilegesRequired")
|
|
25
|
+
user_interaction: PropertyRef = PropertyRef("userInteraction")
|
|
26
|
+
scope: PropertyRef = PropertyRef("scope")
|
|
27
|
+
confidentiality_impact: PropertyRef = PropertyRef("confidentialityImpact")
|
|
28
|
+
integrity_impact: PropertyRef = PropertyRef("integrityImpact")
|
|
29
|
+
availability_impact: PropertyRef = PropertyRef("availabilityImpact")
|
|
30
|
+
base_score: PropertyRef = PropertyRef("baseScore")
|
|
31
|
+
base_severity: PropertyRef = PropertyRef("baseSeverity")
|
|
32
|
+
exploitability_score: PropertyRef = PropertyRef("exploitabilityScore")
|
|
33
|
+
impact_score: PropertyRef = PropertyRef("impactScore")
|
|
34
|
+
published_date: PropertyRef = PropertyRef("published")
|
|
35
|
+
last_modified_date: PropertyRef = PropertyRef("lastModified")
|
|
36
|
+
vuln_status: PropertyRef = PropertyRef("vulnStatus")
|
|
37
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated")
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
@dataclass(frozen=True)
|
|
41
41
|
class CVEtoCVEFeedRelProperties(CartographyRelProperties):
|
|
42
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
@dataclass(frozen=True)
|
|
46
46
|
# (:CVE)<-[:RESOURCE]-(:CVEFeed)
|
|
47
|
-
class
|
|
48
|
-
target_node_label: str =
|
|
47
|
+
class CVEtoCVEFeedRel(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = "CVEFeed"
|
|
49
49
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
-
{
|
|
50
|
+
{"id": PropertyRef("FEED_ID", set_in_kwargs=True)},
|
|
51
51
|
)
|
|
52
52
|
direction: LinkDirection = LinkDirection.INWARD
|
|
53
53
|
rel_label: str = "RESOURCE"
|
|
@@ -56,26 +56,28 @@ class CVEtoCVEFeedRelSchema(CartographyRelSchema):
|
|
|
56
56
|
|
|
57
57
|
@dataclass(frozen=True)
|
|
58
58
|
class CVEToSpotlightVulnerabilityRelProperties(CartographyRelProperties):
|
|
59
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
59
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
@dataclass(frozen=True)
|
|
63
63
|
# (:CVE)<-[:HAS_CVE]-(:SpotlightVulnerability)
|
|
64
64
|
class CVEToSpotlightVulnerabilityRel(CartographyRelSchema):
|
|
65
|
-
target_node_label: str =
|
|
65
|
+
target_node_label: str = "SpotlightVulnerability"
|
|
66
66
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
-
{
|
|
67
|
+
{"id": PropertyRef("id")},
|
|
68
68
|
)
|
|
69
69
|
direction: LinkDirection = LinkDirection.INWARD
|
|
70
70
|
rel_label: str = "HAS_CVE"
|
|
71
|
-
properties: CVEToSpotlightVulnerabilityRelProperties =
|
|
71
|
+
properties: CVEToSpotlightVulnerabilityRelProperties = (
|
|
72
|
+
CVEToSpotlightVulnerabilityRelProperties()
|
|
73
|
+
)
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
@dataclass(frozen=True)
|
|
75
77
|
class CVESchema(CartographyNodeSchema):
|
|
76
|
-
label: str =
|
|
78
|
+
label: str = "CVE"
|
|
77
79
|
properties: CVENodeProperties = CVENodeProperties()
|
|
78
|
-
sub_resource_relationship:
|
|
80
|
+
sub_resource_relationship: CVEtoCVEFeedRel = CVEtoCVEFeedRel()
|
|
79
81
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
80
82
|
[
|
|
81
83
|
CVEToSpotlightVulnerabilityRel(),
|
|
@@ -7,14 +7,14 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class CVEFeedNodeProperties(CartographyNodeProperties):
|
|
10
|
-
id: PropertyRef = PropertyRef(
|
|
11
|
-
lastupdated: PropertyRef = PropertyRef(
|
|
12
|
-
format: PropertyRef = PropertyRef(
|
|
13
|
-
version: PropertyRef = PropertyRef(
|
|
14
|
-
timestamp: PropertyRef = PropertyRef(
|
|
10
|
+
id: PropertyRef = PropertyRef("FEED_ID")
|
|
11
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
12
|
+
format: PropertyRef = PropertyRef("format")
|
|
13
|
+
version: PropertyRef = PropertyRef("version")
|
|
14
|
+
timestamp: PropertyRef = PropertyRef("timestamp")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@dataclass(frozen=True)
|
|
18
18
|
class CVEFeedSchema(CartographyNodeSchema):
|
|
19
|
-
label: str =
|
|
19
|
+
label: str = "CVEFeed"
|
|
20
20
|
properties: CVEFeedNodeProperties = CVEFeedNodeProperties()
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
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 DOAccountNodeProperties(CartographyNodeProperties):
|
|
10
|
+
id: PropertyRef = PropertyRef("id")
|
|
11
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
12
|
+
uuid: PropertyRef = PropertyRef("uuid")
|
|
13
|
+
droplet_limit: PropertyRef = PropertyRef("droplet_limit")
|
|
14
|
+
floating_ip_limit: PropertyRef = PropertyRef("floating_ip_limit")
|
|
15
|
+
status: PropertyRef = PropertyRef("status")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass(frozen=True)
|
|
19
|
+
class DOAccountSchema(CartographyNodeSchema):
|
|
20
|
+
label: str = "DOAccount"
|
|
21
|
+
properties: DOAccountNodeProperties = DOAccountNodeProperties()
|
|
@@ -0,0 +1,56 @@
|
|
|
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 DODropletNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
name: PropertyRef = PropertyRef("name")
|
|
18
|
+
locked: PropertyRef = PropertyRef("locked")
|
|
19
|
+
status: PropertyRef = PropertyRef("status")
|
|
20
|
+
region: PropertyRef = PropertyRef("region")
|
|
21
|
+
created_at: PropertyRef = PropertyRef("created_at")
|
|
22
|
+
image: PropertyRef = PropertyRef("image")
|
|
23
|
+
size: PropertyRef = PropertyRef("size")
|
|
24
|
+
kernel: PropertyRef = PropertyRef("kernel")
|
|
25
|
+
tags: PropertyRef = PropertyRef("tags")
|
|
26
|
+
volumes: PropertyRef = PropertyRef("volumes")
|
|
27
|
+
vpc_uuid: PropertyRef = PropertyRef("vpc_uuid")
|
|
28
|
+
ip_address: PropertyRef = PropertyRef("ip_address")
|
|
29
|
+
private_ip_address: PropertyRef = PropertyRef("private_ip_address")
|
|
30
|
+
ip_v6_address: PropertyRef = PropertyRef("ip_v6_address")
|
|
31
|
+
account_id: PropertyRef = PropertyRef("ACCOUNT_ID", set_in_kwargs=True)
|
|
32
|
+
project_id: PropertyRef = PropertyRef("PROJECT_ID", set_in_kwargs=True)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
class DODropletToAccountRelProperties(CartographyRelProperties):
|
|
37
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
# (:DOProject)<-[:RESOURCE]-(:DODroplet)
|
|
42
|
+
class DODropletToAccountRel(CartographyRelSchema):
|
|
43
|
+
target_node_label: str = "DOProject"
|
|
44
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
45
|
+
{"id": PropertyRef("PROJECT_ID", set_in_kwargs=True)},
|
|
46
|
+
)
|
|
47
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
48
|
+
rel_label: str = "RESOURCE"
|
|
49
|
+
properties: DODropletToAccountRelProperties = DODropletToAccountRelProperties()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(frozen=True)
|
|
53
|
+
class DODropletSchema(CartographyNodeSchema):
|
|
54
|
+
label: str = "DODroplet"
|
|
55
|
+
properties: DODropletNodeProperties = DODropletNodeProperties()
|
|
56
|
+
sub_resource_relationship: DODropletToAccountRel = DODropletToAccountRel()
|
|
@@ -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 DOProjectNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
account_id: PropertyRef = PropertyRef("ACCOUNT_ID", set_in_kwargs=True)
|
|
18
|
+
name: PropertyRef = PropertyRef("name")
|
|
19
|
+
owner_uuid: PropertyRef = PropertyRef("owner_uuid")
|
|
20
|
+
description: PropertyRef = PropertyRef("description")
|
|
21
|
+
environment: PropertyRef = PropertyRef("environment")
|
|
22
|
+
is_default: PropertyRef = PropertyRef("is_default")
|
|
23
|
+
created_at: PropertyRef = PropertyRef("created_at")
|
|
24
|
+
updated_at: PropertyRef = PropertyRef("updated_at")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
class DOProjectToAccountRelProperties(CartographyRelProperties):
|
|
29
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
# (:DOAccount)<-[:RESOURCE]-(:DOProject)
|
|
34
|
+
class DOProjectToAccountRel(CartographyRelSchema):
|
|
35
|
+
target_node_label: str = "DOAccount"
|
|
36
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
+
{"id": PropertyRef("ACCOUNT_ID", set_in_kwargs=True)},
|
|
38
|
+
)
|
|
39
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
40
|
+
rel_label: str = "RESOURCE"
|
|
41
|
+
properties: DOProjectToAccountRelProperties = DOProjectToAccountRelProperties()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class DOProjectSchema(CartographyNodeSchema):
|
|
46
|
+
label: str = "DOProject"
|
|
47
|
+
properties: DOProjectNodeProperties = DOProjectNodeProperties()
|
|
48
|
+
sub_resource_relationship: DOProjectToAccountRel = DOProjectToAccountRel()
|
|
@@ -7,11 +7,11 @@ from cartography.models.core.nodes import CartographyNodeSchema
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True)
|
|
9
9
|
class DuoApiHostNodeProperties(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 DuoApiHostSchema(CartographyNodeSchema):
|
|
16
|
-
label: str =
|
|
16
|
+
label: str = "DuoApiHost"
|
|
17
17
|
properties: DuoApiHostNodeProperties = DuoApiHostNodeProperties()
|