From 6417fd4de1a214a6f02ab73e08b51a5eae1a0374 Mon Sep 17 00:00:00 2001 From: Hossein Rouhani <56231339+HRouhani@users.noreply.github.com> Date: Thu, 22 Feb 2024 22:28:37 +0100 Subject: [PATCH] added the status of the Log delivery (#3379) Signed-off-by: Hossein Rouhani --- providers/aws/resources/aws.lr | 2 ++ providers/aws/resources/aws.lr.go | 12 ++++++++++++ providers/aws/resources/aws.lr.manifest.yaml | 2 ++ providers/aws/resources/aws_vpc.go | 1 + 4 files changed, 17 insertions(+) diff --git a/providers/aws/resources/aws.lr b/providers/aws/resources/aws.lr index 834cc2f6f9..50ff1a4d9e 100644 --- a/providers/aws/resources/aws.lr +++ b/providers/aws/resources/aws.lr @@ -137,6 +137,8 @@ private aws.vpc.flowlog @defaults("id region status") { destination string // The destination type for the flow log data destinationType string + // The delivery log status for the flow log data + deliverLogsStatus string // The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). maxAggregationInterval int // The type of traffic to monitor. ACCEPT, ALL, and REJECT diff --git a/providers/aws/resources/aws.lr.go b/providers/aws/resources/aws.lr.go index f874315059..402bd1963f 100644 --- a/providers/aws/resources/aws.lr.go +++ b/providers/aws/resources/aws.lr.go @@ -856,6 +856,9 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "aws.vpc.flowlog.destinationType": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsVpcFlowlog).GetDestinationType()).ToDataRes(types.String) }, + "aws.vpc.flowlog.deliverLogsStatus": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsVpcFlowlog).GetDeliverLogsStatus()).ToDataRes(types.String) + }, "aws.vpc.flowlog.maxAggregationInterval": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsVpcFlowlog).GetMaxAggregationInterval()).ToDataRes(types.Int) }, @@ -3872,6 +3875,10 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlAwsVpcFlowlog).DestinationType, ok = plugin.RawToTValue[string](v.Value, v.Error) return }, + "aws.vpc.flowlog.deliverLogsStatus": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsVpcFlowlog).DeliverLogsStatus, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, "aws.vpc.flowlog.maxAggregationInterval": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlAwsVpcFlowlog).MaxAggregationInterval, ok = plugin.RawToTValue[int64](v.Value, v.Error) return @@ -8777,6 +8784,7 @@ type mqlAwsVpcFlowlog struct { CreatedAt plugin.TValue[*time.Time] Destination plugin.TValue[string] DestinationType plugin.TValue[string] + DeliverLogsStatus plugin.TValue[string] MaxAggregationInterval plugin.TValue[int64] TrafficType plugin.TValue[string] } @@ -8845,6 +8853,10 @@ func (c *mqlAwsVpcFlowlog) GetDestinationType() *plugin.TValue[string] { return &c.DestinationType } +func (c *mqlAwsVpcFlowlog) GetDeliverLogsStatus() *plugin.TValue[string] { + return &c.DeliverLogsStatus +} + func (c *mqlAwsVpcFlowlog) GetMaxAggregationInterval() *plugin.TValue[int64] { return &c.MaxAggregationInterval } diff --git a/providers/aws/resources/aws.lr.manifest.yaml b/providers/aws/resources/aws.lr.manifest.yaml index 1c22519735..1480d2d5cf 100755 --- a/providers/aws/resources/aws.lr.manifest.yaml +++ b/providers/aws/resources/aws.lr.manifest.yaml @@ -2469,6 +2469,8 @@ resources: fields: createdAt: min_mondoo_version: 9.0.0 + deliverLogsStatus: + min_mondoo_version: 9.0.0 destination: min_mondoo_version: 9.0.0 destinationType: diff --git a/providers/aws/resources/aws_vpc.go b/providers/aws/resources/aws_vpc.go index c292cdf267..bdcf7761c0 100644 --- a/providers/aws/resources/aws_vpc.go +++ b/providers/aws/resources/aws_vpc.go @@ -180,6 +180,7 @@ func (a *mqlAwsVpc) flowLogs() ([]interface{}, error) { "createdAt": llx.TimeDataPtr(flowLog.CreationTime), "destination": llx.StringDataPtr(flowLog.LogDestination), "destinationType": llx.StringData(string(flowLog.LogDestinationType)), + "deliverLogsStatus": llx.StringDataPtr(flowLog.DeliverLogsStatus), "id": llx.StringDataPtr(flowLog.FlowLogId), "maxAggregationInterval": llx.IntData(convert.ToInt64From32(flowLog.MaxAggregationInterval)), "region": llx.StringData(a.Region.Data),