From 052f257f06d6ba42286c39e40113b0e5203b4419 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Thu, 19 Dec 2024 14:13:08 +0530 Subject: [PATCH] chore: remove region relationships --- scrapers/aws/aws.go | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/scrapers/aws/aws.go b/scrapers/aws/aws.go index 97361d16..6dc8da8c 100644 --- a/scrapers/aws/aws.go +++ b/scrapers/aws/aws.go @@ -1045,13 +1045,6 @@ func (aws Scraper) vpcs(ctx *AWSContext, config v1.AWS, results *v1.ScrapeResult Relationship: "VPCDHCPOptions", }) - // VPC to region relationship - relationships = append(relationships, v1.RelationshipResult{ - RelatedExternalID: v1.ExternalID{ExternalID: string(*vpc.VpcId), ConfigType: v1.AWSEC2VPC}, - ConfigExternalID: v1.ExternalID{ExternalID: ctx.Session.Region, ConfigType: v1.AWSRegion}, - Relationship: "RegionVPC", - }) - labels := getLabels(vpc.Tags) labels["network"] = *vpc.VpcId @@ -1150,12 +1143,6 @@ func (aws Scraper) instances(ctx *AWSContext, config v1.AWS, results *v1.ScrapeR Relationship: "SubnetInstance", }) - relationships = append(relationships, v1.RelationshipResult{ - ConfigExternalID: v1.ExternalID{ExternalID: ctx.Session.Region, ConfigType: v1.AWSRegion}, - RelatedExternalID: selfExternalID, - Relationship: "RegionInstance", - }) - instance := NewInstance(i) labels := instance.Tags if labels == nil { @@ -1620,28 +1607,17 @@ func (aws Scraper) subnets(ctx *AWSContext, config v1.AWS, results *v1.ScrapeRes return } - var relationships []v1.RelationshipResult - selfExternalID := v1.ExternalID{ExternalID: lo.FromPtr(subnet.SubnetId), ConfigType: v1.AWSEC2Subnet} - - // Subnet to Region relationship - relationships = append(relationships, v1.RelationshipResult{ - RelatedExternalID: selfExternalID, - ConfigExternalID: v1.ExternalID{ExternalID: ctx.Session.Region, ConfigType: v1.AWSRegion}, - Relationship: "RegionSubnet", - }) - result := v1.ScrapeResult{ - Type: v1.AWSEC2Subnet, - Status: string(subnet.State), - BaseScraper: config.BaseScraper, - Labels: labels, - Tags: tags, - ConfigClass: "Subnet", - ID: *subnet.SubnetId, - Config: subnet, - Parents: []v1.ConfigExternalKey{{Type: v1.AWSEC2VPC, ExternalID: lo.FromPtr(subnet.VpcId)}}, - Properties: []*types.Property{getConsoleLink(ctx.Session.Region, v1.AWSEC2Subnet, lo.FromPtr(subnet.SubnetId), nil)}, - RelationshipResults: relationships, + Type: v1.AWSEC2Subnet, + Status: string(subnet.State), + BaseScraper: config.BaseScraper, + Labels: labels, + Tags: tags, + ConfigClass: "Subnet", + ID: *subnet.SubnetId, + Config: subnet, + Parents: []v1.ConfigExternalKey{{Type: v1.AWSEC2VPC, ExternalID: lo.FromPtr(subnet.VpcId)}}, + Properties: []*types.Property{getConsoleLink(ctx.Session.Region, v1.AWSEC2Subnet, lo.FromPtr(subnet.SubnetId), nil)}, } *results = append(*results, result)