From 64393f48b7bcf26a3c3d595e70e09413c6c26ff1 Mon Sep 17 00:00:00 2001 From: Harry Lincoln Date: Mon, 17 Mar 2025 17:00:24 +0000 Subject: [PATCH 1/2] Add instance id to result labels --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index be407e8..a7fc914 100644 --- a/main.go +++ b/main.go @@ -261,8 +261,10 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api err = apiHelper.CreateResult( streamId.String(), map[string]string{ - "type": "aws-cloud--ec2", - "_policy": policyPath, + "type": "aws", + "serice": "ec2", + "instance_id": fmt.Sprintf("%v", instance["InstanceID"]), + "_policy": policyPath, }, policyPath, assessmentResult.Result()) From 2fa078cc3998e146ff472e6bc3c2f0b7bd53a7fc Mon Sep 17 00:00:00 2001 From: Harry Lincoln Date: Mon, 17 Mar 2025 17:03:29 +0000 Subject: [PATCH 2/2] Add instance id to result labels 2 --- main.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index a7fc914..65ddd33 100644 --- a/main.go +++ b/main.go @@ -145,7 +145,8 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api }, Labels: map[string]string{ "package": string(result.Policy.Package), - "type": "aws-cloud--ec2", + "type": "aws", + "service": "ec2", "instanceID": fmt.Sprintf("%v", instance["InstanceID"]), }, }) @@ -161,7 +162,8 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api }, Labels: map[string]string{ "package": string(result.Policy.Package), - "type": "aws-cloud--ec2", + "type": "aws", + "service": "ec2", "instanceID": fmt.Sprintf("%v", instance["InstanceID"]), }, }) @@ -185,7 +187,8 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api }, Labels: map[string]string{ "package": string(result.Policy.Package), - "type": "aws-cloud--ec2", + "type": "aws", + "service": "ec2", "instanceID": fmt.Sprintf("%v", instance["InstanceID"]), }, }) @@ -208,7 +211,8 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api }, Labels: map[string]string{ "package": string(result.Policy.Package), - "type": "aws-cloud--ec2", + "type": "aws", + "service": "ec2", "instanceID": fmt.Sprintf("%v", instance["InstanceID"]), }, }) @@ -240,7 +244,8 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api assessmentResult.End = timestamppb.New(endTime) streamId, err := sdk.SeededUUID(map[string]string{ - "type": "aws-cloud--ec2", + "type": "aws", + "service": "ec2", "_policy": policyPath, "instance_id": fmt.Sprintf("%v", instance["InstanceID"]), }) @@ -262,7 +267,7 @@ func (l *CompliancePlugin) Eval(request *proto.EvalRequest, apiHelper runner.Api streamId.String(), map[string]string{ "type": "aws", - "serice": "ec2", + "service": "ec2", "instance_id": fmt.Sprintf("%v", instance["InstanceID"]), "_policy": policyPath, },