Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐ Add additional fields to ECR resource #4938

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,12 @@ private aws.ecr.image @defaults("uri region") {
arn string
// uri for the image repository
uri string
// The time the image was pushed
pushedAt time
// The size of the image in bytes
sizeInBytes int
// The last time Amazon recorded an image pull. Note: Amazon only refreshes this data once every 24 hours so it is not fully granular.
tas50 marked this conversation as resolved.
Show resolved Hide resolved
tas50 marked this conversation as resolved.
Show resolved Hide resolved
lastRecordedPullTime time
}

// AWS Database Migration Service (DMS)
Expand Down
36 changes: 36 additions & 0 deletions providers/aws/resources/aws.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions providers/aws/resources/aws.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,10 +1294,16 @@ resources:
fields:
arn: {}
digest: {}
lastRecordedPullTime:
min_mondoo_version: 9.0.0
mediaType: {}
pushedAt:
min_mondoo_version: 9.0.0
region: {}
registryId: {}
repoName: {}
sizeInBytes:
min_mondoo_version: 9.0.0
tags: {}
uri: {}
is_private: true
Expand Down
19 changes: 11 additions & 8 deletions providers/aws/resources/aws_ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,17 @@ func (a *mqlAwsEcrRepository) images() ([]interface{}, error) {
}
mqlImage, err := CreateResource(a.MqlRuntime, "aws.ecr.image",
map[string]*llx.RawData{
"digest": llx.StringDataPtr(image.ImageDigest),
"mediaType": llx.StringDataPtr(image.ImageManifestMediaType),
"tags": llx.ArrayData(tags, types.String),
"registryId": llx.StringDataPtr(image.RegistryId),
"repoName": llx.StringData(name),
"region": llx.StringData(region),
"arn": llx.StringData(ecrImageArn(ImageInfo{Region: region, RegistryId: convert.ToString(image.RegistryId), RepoName: name, Digest: convert.ToString(image.ImageDigest)})),
"uri": llx.StringData(uri),
"arn": llx.StringData(ecrImageArn(ImageInfo{Region: region, RegistryId: convert.ToString(image.RegistryId), RepoName: name, Digest: convert.ToString(image.ImageDigest)})),
"digest": llx.StringDataPtr(image.ImageDigest),
"lastRecordedPullTime": llx.TimeDataPtr(image.LastRecordedPullTime),
"mediaType": llx.StringDataPtr(image.ImageManifestMediaType),
"pushedAt": llx.TimeDataPtr(image.ImagePushedAt),
"region": llx.StringData(region),
"registryId": llx.StringDataPtr(image.RegistryId),
"repoName": llx.StringData(name),
"sizeInBytes": llx.IntDataPtr(image.ImageSizeInBytes),
"tags": llx.ArrayData(tags, types.String),
"uri": llx.StringData(uri),
})
if err != nil {
return nil, err
Expand Down
Loading