Skip to content

Commit

Permalink
New defaults and fields for aws.ec2.volume (#2784)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Dec 11, 2023
1 parent 472315c commit 132cc97
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 11 deletions.
10 changes: 9 additions & 1 deletion providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ private aws.ec2.snapshot @defaults("arn") {
}

// Amazon EC2 volume
private aws.ec2.volume @defaults("arn encrypted state") {
private aws.ec2.volume @defaults("id region volumeType size encrypted state") {
// ARN for the EC2 volume
arn string
// ID of the EC2 volume
Expand All @@ -1775,6 +1775,14 @@ private aws.ec2.volume @defaults("arn encrypted state") {
createTime time
// Region where the EC2 volume is stored
region string
// Whether Amazon EBS Multi-Attach is enabled.
multiAttachEnabled bool
// The throughput that the volume supports, in MiB/s.
throughput int
// The size of the volume, in GiBs.
size int
// The number of I/O operations per second (IOPS). For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
iops int
}

// Amazon EC2 instance
Expand Down
48 changes: 48 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.

8 changes: 8 additions & 0 deletions providers/aws/resources/aws.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,17 @@ resources:
min_mondoo_version: 5.25.0
encrypted: {}
id: {}
iops:
min_mondoo_version: 9.11.0
multiAttachEnabled:
min_mondoo_version: 9.11.0
region: {}
size:
min_mondoo_version: 9.11.0
state: {}
tags: {}
throughput:
min_mondoo_version: 9.11.0
volumeType: {}
is_private: true
min_mondoo_version: 5.15.0
Expand Down
24 changes: 14 additions & 10 deletions providers/aws/resources/aws_ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,16 +1051,20 @@ func (a *mqlAwsEc2) getVolumes(conn *connection.AwsConnection) []*jobpool.Job {
}
mqlVol, err := CreateResource(a.MqlRuntime, "aws.ec2.volume",
map[string]*llx.RawData{
"arn": llx.StringData(fmt.Sprintf(volumeArnPattern, region, conn.AccountId(), convert.ToString(vol.VolumeId))),
"id": llx.StringData(convert.ToString(vol.VolumeId)),
"attachments": llx.ArrayData(jsonAttachments, types.Any),
"encrypted": llx.BoolData(convert.ToBool(vol.Encrypted)),
"state": llx.StringData(string(vol.State)),
"tags": llx.MapData(Ec2TagsToMap(vol.Tags), types.String),
"availabilityZone": llx.StringData(convert.ToString(vol.AvailabilityZone)),
"volumeType": llx.StringData(string(vol.VolumeType)),
"createTime": llx.TimeDataPtr(vol.CreateTime),
"region": llx.StringData(regionVal),
"arn": llx.StringData(fmt.Sprintf(volumeArnPattern, region, conn.AccountId(), convert.ToString(vol.VolumeId))),
"attachments": llx.ArrayData(jsonAttachments, types.Any),
"availabilityZone": llx.StringDataPtr(vol.AvailabilityZone),
"createTime": llx.TimeDataPtr(vol.CreateTime),
"encrypted": llx.BoolDataPtr(vol.Encrypted),
"id": llx.StringDataPtr(vol.VolumeId),
"iops": llx.IntData(convert.ToInt64From32(vol.Iops)),
"multiAttachEnabled": llx.BoolDataPtr(vol.MultiAttachEnabled),
"region": llx.StringData(regionVal),
"size": llx.IntData(convert.ToInt64From32(vol.Size)),
"state": llx.StringData(string(vol.State)),
"tags": llx.MapData(Ec2TagsToMap(vol.Tags), types.String),
"throughput": llx.IntData(convert.ToInt64From32(vol.Throughput)),
"volumeType": llx.StringData(string(vol.VolumeType)),
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 132cc97

Please sign in to comment.