diff --git a/providers/aws/config/config.go b/providers/aws/config/config.go index 9063c7ee08..9f8e92ebf8 100644 --- a/providers/aws/config/config.go +++ b/providers/aws/config/config.go @@ -4,6 +4,7 @@ package config import ( + "go.mondoo.com/cnquery/v10/providers-sdk/v1/inventory" "go.mondoo.com/cnquery/v10/providers-sdk/v1/plugin" "go.mondoo.com/cnquery/v10/providers/aws/connection/awsec2ebsconn" "go.mondoo.com/cnquery/v10/providers/aws/provider" @@ -102,4 +103,20 @@ var Config = plugin.Provider{ }, }, }, + AssetUrlTrees: []*inventory.AssetUrlBranch{ + { + PathSegments: []string{"technology=aws"}, + Key: "account", + Title: "Account", + Values: map[string]*inventory.AssetUrlBranch{ + "*": { + Key: "service", + Title: "Service", + Values: map[string]*inventory.AssetUrlBranch{ + "account": nil, + }, + }, + }, + }, + }, } diff --git a/providers/aws/connection/platform.go b/providers/aws/connection/platform.go index 705191cb7e..d64d9a6310 100644 --- a/providers/aws/connection/platform.go +++ b/providers/aws/connection/platform.go @@ -6,23 +6,25 @@ package connection import "go.mondoo.com/cnquery/v10/providers-sdk/v1/inventory" func (a *AwsConnection) PlatformInfo() *inventory.Platform { - return GetPlatformForObject(a.PlatformOverride) + return GetPlatformForObject(a.PlatformOverride, a.accountId) } -func GetPlatformForObject(platformName string) *inventory.Platform { +func GetPlatformForObject(platformName string, accountId string) *inventory.Platform { if platformName != "aws" && platformName != "" { return &inventory.Platform{ - Name: platformName, - Title: getTitleForPlatformName(platformName), - Kind: "aws-object", - Runtime: "aws", + Name: platformName, + Title: getTitleForPlatformName(platformName), + Kind: "aws-object", + Runtime: "aws", + TechnologyUrlSegments: []string{"aws", accountId, "account"}, } } return &inventory.Platform{ - Name: "aws", - Title: "AWS Account", - Kind: "api", - Runtime: "aws", + Name: "aws", + Title: "AWS Account", + Kind: "api", + Runtime: "aws", + TechnologyUrlSegments: []string{"aws", accountId, "account"}, } } diff --git a/providers/aws/resources/discovery_conversion.go b/providers/aws/resources/discovery_conversion.go index 6310ab6342..42b264bfd7 100644 --- a/providers/aws/resources/discovery_conversion.go +++ b/providers/aws/resources/discovery_conversion.go @@ -67,7 +67,7 @@ func MqlObjectToAsset(account string, mqlObject mqlObject, conn *connection.AwsC return &inventory.Asset{ PlatformIds: platformIds, Name: mqlObject.name, - Platform: connection.GetPlatformForObject(platformName), + Platform: connection.GetPlatformForObject(platformName, account), Labels: mqlObject.labels, Connections: []*inventory.Config{t.Clone(inventory.WithoutDiscovery(), inventory.WithParentConnectionId(t.Id))}, Options: conn.ConnectionOptions(), @@ -206,7 +206,7 @@ func accountAsset(conn *connection.AwsConnection, awsAccount *mqlAwsAccount) *in return &inventory.Asset{ PlatformIds: []string{id}, Name: name, - Platform: connection.GetPlatformForObject(""), + Platform: connection.GetPlatformForObject("", accountId), Connections: []*inventory.Config{conn.Conf.Clone(inventory.WithoutDiscovery(), inventory.WithParentConnectionId(conn.Conf.Id))}, Options: conn.ConnectionOptions(), }