From 2092d1f02c9b92cc37d01065977b568ebfadabf8 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 13 Feb 2025 16:08:35 -0800 Subject: [PATCH] Wire up the remainder of aws.iam.role.createdAt It was in the code but not the lr which caused failures ``` [failed] [].all() error: [aws] cannot set 'createdAt' in resource 'aws.iam.group', field not found ``` Signed-off-by: Tim Smith --- providers/aws/resources/aws.lr | 4 +++- providers/aws/resources/aws.lr.go | 12 ++++++++++++ providers/aws/resources/aws.lr.manifest.yaml | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/providers/aws/resources/aws.lr b/providers/aws/resources/aws.lr index 535487e597..db633a02d2 100644 --- a/providers/aws/resources/aws.lr +++ b/providers/aws/resources/aws.lr @@ -907,8 +907,10 @@ private aws.iam.group @defaults("arn name") { id string // Name of the group name string - // Time when the group was created + // Time when the group was created: deprecated, use createdAt createDate time + // Time when the group was created + createdAt time // List of usernames that belong to the group usernames []string } diff --git a/providers/aws/resources/aws.lr.go b/providers/aws/resources/aws.lr.go index 879c5b3d15..bc812e41aa 100644 --- a/providers/aws/resources/aws.lr.go +++ b/providers/aws/resources/aws.lr.go @@ -1844,6 +1844,9 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "aws.iam.group.createDate": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsIamGroup).GetCreateDate()).ToDataRes(types.Time) }, + "aws.iam.group.createdAt": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsIamGroup).GetCreatedAt()).ToDataRes(types.Time) + }, "aws.iam.group.usernames": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsIamGroup).GetUsernames()).ToDataRes(types.Array(types.String)) }, @@ -6596,6 +6599,10 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlAwsIamGroup).CreateDate, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) return }, + "aws.iam.group.createdAt": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsIamGroup).CreatedAt, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) + return + }, "aws.iam.group.usernames": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlAwsIamGroup).Usernames, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) return @@ -15963,6 +15970,7 @@ type mqlAwsIamGroup struct { Id plugin.TValue[string] Name plugin.TValue[string] CreateDate plugin.TValue[*time.Time] + CreatedAt plugin.TValue[*time.Time] Usernames plugin.TValue[[]interface{}] } @@ -16019,6 +16027,10 @@ func (c *mqlAwsIamGroup) GetCreateDate() *plugin.TValue[*time.Time] { return &c.CreateDate } +func (c *mqlAwsIamGroup) GetCreatedAt() *plugin.TValue[*time.Time] { + return &c.CreatedAt +} + func (c *mqlAwsIamGroup) GetUsernames() *plugin.TValue[[]interface{}] { return &c.Usernames } diff --git a/providers/aws/resources/aws.lr.manifest.yaml b/providers/aws/resources/aws.lr.manifest.yaml index 5162f3c949..79922dc139 100755 --- a/providers/aws/resources/aws.lr.manifest.yaml +++ b/providers/aws/resources/aws.lr.manifest.yaml @@ -2006,6 +2006,8 @@ resources: fields: arn: {} createDate: {} + createdAt: + min_mondoo_version: 9.0.0 id: {} name: {} usernames: {}