diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 3c3a1d45f7..0f6ce24f4d 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -66,3 +66,4 @@ uid:\s.*$ aws_session_token\s+\=(\s+)?.+ aws_access_key_id\s+\=(\s+)?.+ aws_secret_access_key\s+\=(\s+)?.+ + diff --git a/providers/aws/resources/aws.lr b/providers/aws/resources/aws.lr index 2eb16e18ea..23a76566ab 100644 --- a/providers/aws/resources/aws.lr +++ b/providers/aws/resources/aws.lr @@ -523,6 +523,10 @@ private aws.elb.loadbalancer @defaults("arn name") { scheme string // A list of attributes for the load balancer attributes() []dict + // The ID of the VPC where the load balancer is located + vpcId string + // Date and time when the load balancer was created + createdTime time } // AWS CodeBuild for building and testing code @@ -996,7 +1000,7 @@ private aws.s3.bucket @defaults("arn") { // False if the bucket no longer exists (stale reference) exists bool // Date the bucket was created - creationDate time + createdTime time } // Amazon S3 Bucket Grant @@ -1258,7 +1262,7 @@ private aws.rds.dbinstance @defaults("id region engine engineVersion") { // Indicates whether minor version patches are applied automatically autoMinorVersionUpgrade bool // The creation date of the RDS instance - creationDate time + createdTime time } // Amazon ElastiCache diff --git a/providers/aws/resources/aws.lr.go b/providers/aws/resources/aws.lr.go index c5f3076457..920a96391b 100644 --- a/providers/aws/resources/aws.lr.go +++ b/providers/aws/resources/aws.lr.go @@ -1111,6 +1111,12 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "aws.elb.loadbalancer.attributes": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsElbLoadbalancer).GetAttributes()).ToDataRes(types.Array(types.Dict)) }, + "aws.elb.loadbalancer.vpcId": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsElbLoadbalancer).GetVpcId()).ToDataRes(types.String) + }, + "aws.elb.loadbalancer.createdTime": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsElbLoadbalancer).GetCreatedTime()).ToDataRes(types.Time) + }, "aws.codebuild.projects": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsCodebuild).GetProjects()).ToDataRes(types.Array(types.Resource("aws.codebuild.project"))) }, @@ -1624,8 +1630,8 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "aws.s3.bucket.exists": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsS3Bucket).GetExists()).ToDataRes(types.Bool) }, - "aws.s3.bucket.creationDate": func(r plugin.Resource) *plugin.DataRes { - return (r.(*mqlAwsS3Bucket).GetCreationDate()).ToDataRes(types.Time) + "aws.s3.bucket.createdTime": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsS3Bucket).GetCreatedTime()).ToDataRes(types.Time) }, "aws.s3.bucket.grant.id": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsS3BucketGrant).GetId()).ToDataRes(types.String) @@ -1918,8 +1924,8 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "aws.rds.dbinstance.autoMinorVersionUpgrade": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsRdsDbinstance).GetAutoMinorVersionUpgrade()).ToDataRes(types.Bool) }, - "aws.rds.dbinstance.creationDate": func(r plugin.Resource) *plugin.DataRes { - return (r.(*mqlAwsRdsDbinstance).GetCreationDate()).ToDataRes(types.Time) + "aws.rds.dbinstance.createdTime": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlAwsRdsDbinstance).GetCreatedTime()).ToDataRes(types.Time) }, "aws.elasticache.clusters": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlAwsElasticache).GetClusters()).ToDataRes(types.Array(types.Dict)) @@ -3487,6 +3493,14 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlAwsElbLoadbalancer).Attributes, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) return }, + "aws.elb.loadbalancer.vpcId": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsElbLoadbalancer).VpcId, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "aws.elb.loadbalancer.createdTime": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsElbLoadbalancer).CreatedTime, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) + return + }, "aws.codebuild.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlAwsCodebuild).__id, ok = v.Value.(string) return @@ -4299,8 +4313,8 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlAwsS3Bucket).Exists, ok = plugin.RawToTValue[bool](v.Value, v.Error) return }, - "aws.s3.bucket.creationDate": func(r plugin.Resource, v *llx.RawData) (ok bool) { - r.(*mqlAwsS3Bucket).CreationDate, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) + "aws.s3.bucket.createdTime": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsS3Bucket).CreatedTime, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) return }, "aws.s3.bucket.grant.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { @@ -4755,8 +4769,8 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlAwsRdsDbinstance).AutoMinorVersionUpgrade, ok = plugin.RawToTValue[bool](v.Value, v.Error) return }, - "aws.rds.dbinstance.creationDate": func(r plugin.Resource, v *llx.RawData) (ok bool) { - r.(*mqlAwsRdsDbinstance).CreationDate, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) + "aws.rds.dbinstance.createdTime": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlAwsRdsDbinstance).CreatedTime, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) return }, "aws.elasticache.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { @@ -8744,6 +8758,8 @@ type mqlAwsElbLoadbalancer struct { Name plugin.TValue[string] Scheme plugin.TValue[string] Attributes plugin.TValue[[]interface{}] + VpcId plugin.TValue[string] + CreatedTime plugin.TValue[*time.Time] } // createAwsElbLoadbalancer creates a new instance of this resource @@ -8811,6 +8827,14 @@ func (c *mqlAwsElbLoadbalancer) GetAttributes() *plugin.TValue[[]interface{}] { }) } +func (c *mqlAwsElbLoadbalancer) GetVpcId() *plugin.TValue[string] { + return &c.VpcId +} + +func (c *mqlAwsElbLoadbalancer) GetCreatedTime() *plugin.TValue[*time.Time] { + return &c.CreatedTime +} + // mqlAwsCodebuild for the aws.codebuild resource type mqlAwsCodebuild struct { MqlRuntime *plugin.Runtime @@ -11289,7 +11313,7 @@ type mqlAwsS3Bucket struct { Encryption plugin.TValue[interface{}] PublicAccessBlock plugin.TValue[interface{}] Exists plugin.TValue[bool] - CreationDate plugin.TValue[*time.Time] + CreatedTime plugin.TValue[*time.Time] } // createAwsS3Bucket creates a new instance of this resource @@ -11455,8 +11479,8 @@ func (c *mqlAwsS3Bucket) GetExists() *plugin.TValue[bool] { return &c.Exists } -func (c *mqlAwsS3Bucket) GetCreationDate() *plugin.TValue[*time.Time] { - return &c.CreationDate +func (c *mqlAwsS3Bucket) GetCreatedTime() *plugin.TValue[*time.Time] { + return &c.CreatedTime } // mqlAwsS3BucketGrant for the aws.s3.bucket.grant resource @@ -12637,7 +12661,7 @@ type mqlAwsRdsDbinstance struct { SecurityGroups plugin.TValue[[]interface{}] Status plugin.TValue[string] AutoMinorVersionUpgrade plugin.TValue[bool] - CreationDate plugin.TValue[*time.Time] + CreatedTime plugin.TValue[*time.Time] } // createAwsRdsDbinstance creates a new instance of this resource @@ -12785,8 +12809,8 @@ func (c *mqlAwsRdsDbinstance) GetAutoMinorVersionUpgrade() *plugin.TValue[bool] return &c.AutoMinorVersionUpgrade } -func (c *mqlAwsRdsDbinstance) GetCreationDate() *plugin.TValue[*time.Time] { - return &c.CreationDate +func (c *mqlAwsRdsDbinstance) GetCreatedTime() *plugin.TValue[*time.Time] { + return &c.CreatedTime } // mqlAwsElasticache for the aws.elasticache resource diff --git a/providers/aws/resources/aws.lr.manifest.yaml b/providers/aws/resources/aws.lr.manifest.yaml index 6b77138266..7fd3c521a1 100755 --- a/providers/aws/resources/aws.lr.manifest.yaml +++ b/providers/aws/resources/aws.lr.manifest.yaml @@ -1375,10 +1375,14 @@ resources: fields: arn: {} attributes: {} + createdTime: + min_mondoo_version: 9.0.0 dnsName: {} listenerDescriptions: {} name: {} scheme: {} + vpcId: + min_mondoo_version: 9.0.0 is_private: true min_mondoo_version: 5.15.0 platform: @@ -1805,7 +1809,7 @@ resources: availabilityZone: min_mondoo_version: 9.0.0 backupRetentionPeriod: {} - creationDate: + createdTime: min_mondoo_version: 9.0.0 dbInstanceClass: min_mondoo_version: 5.19.1 @@ -1973,7 +1977,7 @@ resources: acl: {} arn: {} cors: {} - creationDate: + createdTime: min_mondoo_version: 9.0.0 defaultLock: {} encryption: {} diff --git a/providers/aws/resources/aws_acm.go b/providers/aws/resources/aws_acm.go index dad15abf16..78d935b68b 100644 --- a/providers/aws/resources/aws_acm.go +++ b/providers/aws/resources/aws_acm.go @@ -122,9 +122,9 @@ func initAwsAcmCertificate(runtime *plugin.Runtime, args map[string]*llx.RawData } args["arn"] = llx.StringData(arnVal) - args["notBefore"] = llx.TimeData(toTime(certDetails.Certificate.NotBefore)) - args["notAfter"] = llx.TimeData(toTime(certDetails.Certificate.NotAfter)) - args["createdAt"] = llx.TimeData(toTime(certDetails.Certificate.CreatedAt)) + args["notBefore"] = llx.TimeDataPtr(certDetails.Certificate.NotBefore) + args["notAfter"] = llx.TimeDataPtr(certDetails.Certificate.NotAfter) + args["createdAt"] = llx.TimeDataPtr(certDetails.Certificate.CreatedAt) args["domainName"] = llx.StringData(convert.ToString(certDetails.Certificate.DomainName)) args["status"] = llx.StringData(string(certDetails.Certificate.Status)) args["subject"] = llx.StringData(convert.ToString(certDetails.Certificate.Subject)) diff --git a/providers/aws/resources/aws_apigateway.go b/providers/aws/resources/aws_apigateway.go index 8146c28caa..92d662933b 100644 --- a/providers/aws/resources/aws_apigateway.go +++ b/providers/aws/resources/aws_apigateway.go @@ -76,7 +76,7 @@ func (a *mqlAwsApigateway) getRestApis(conn *connection.AwsConnection) []*jobpoo "id": llx.StringData(convert.ToString(restApi.Id)), "name": llx.StringData(convert.ToString(restApi.Name)), "description": llx.StringData(convert.ToString(restApi.Description)), - "createdDate": llx.TimeData(toTime(restApi.CreatedDate)), + "createdDate": llx.TimeDataPtr(restApi.CreatedDate), "region": llx.StringData(regionVal), "tags": llx.MapData(strMapToInterface(restApi.Tags), types.String), }) diff --git a/providers/aws/resources/aws_backups.go b/providers/aws/resources/aws_backups.go index 7c4bf05c94..7632184d31 100644 --- a/providers/aws/resources/aws_backups.go +++ b/providers/aws/resources/aws_backups.go @@ -127,8 +127,8 @@ func (a *mqlAwsBackupVault) recoveryPoints() ([]interface{}, error) { "createdBy": llx.MapData(createdBy, types.String), "iamRoleArn": llx.StringData(convert.ToString(rp.IamRoleArn)), "status": llx.StringData(string(rp.Status)), - "creationDate": llx.TimeData(toTime(rp.CreationDate)), - "completionDate": llx.TimeData(toTime(rp.CompletionDate)), + "creationDate": llx.TimeDataPtr(rp.CreationDate), + "completionDate": llx.TimeDataPtr(rp.CompletionDate), "encryptionKeyArn": llx.StringData(convert.ToString(rp.EncryptionKeyArn)), "isEncrypted": llx.BoolData(convert.ToBool(&rp.IsEncrypted)), }) diff --git a/providers/aws/resources/aws_cloudfront.go b/providers/aws/resources/aws_cloudfront.go index f21dfff879..dad6ae8048 100644 --- a/providers/aws/resources/aws_cloudfront.go +++ b/providers/aws/resources/aws_cloudfront.go @@ -136,8 +136,8 @@ func (a *mqlAwsCloudfront) functions() ([]interface{}, error) { args := map[string]*llx.RawData{ "name": llx.StringData(convert.ToString(funct.Name)), "status": llx.StringData(convert.ToString(funct.Status)), - "lastModifiedTime": llx.TimeData(toTime(lmTime)), - "createdTime": llx.TimeData(toTime(crTime)), + "lastModifiedTime": llx.TimeDataPtr(lmTime), + "createdTime": llx.TimeDataPtr(crTime), "stage": llx.StringData(stage), "comment": llx.StringData(comment), "runtime": llx.StringData(runtime), diff --git a/providers/aws/resources/aws_cloudwatch.go b/providers/aws/resources/aws_cloudwatch.go index d319ea1287..47f58f0769 100644 --- a/providers/aws/resources/aws_cloudwatch.go +++ b/providers/aws/resources/aws_cloudwatch.go @@ -304,7 +304,7 @@ func initAwsCloudwatchMetricstatistics(runtime *plugin.Runtime, args map[string] for _, datapoint := range statsResp.Datapoints { mqlDatapoint, err := CreateResource(runtime, "aws.cloudwatch.metric.datapoint", map[string]*llx.RawData{ - "timestamp": llx.TimeData(toTime(datapoint.Timestamp)), + "timestamp": llx.TimeDataPtr(datapoint.Timestamp), "maximum": llx.FloatData(convert.ToFloat64(datapoint.Maximum)), "minimum": llx.FloatData(convert.ToFloat64(datapoint.Minimum)), "average": llx.FloatData(convert.ToFloat64(datapoint.Average)), @@ -369,7 +369,7 @@ func (a *mqlAwsCloudwatchMetric) statistics() (*mqlAwsCloudwatchMetricstatistics mqlDatapoint, err := CreateResource(a.MqlRuntime, "aws.cloudwatch.metric.datapoint", map[string]*llx.RawData{ "id": llx.StringData(formatDatapointId(datapoint)), - "timestamp": llx.TimeData(toTime(datapoint.Timestamp)), + "timestamp": llx.TimeDataPtr(datapoint.Timestamp), "maximum": llx.FloatData(convert.ToFloat64(datapoint.Maximum)), "minimum": llx.FloatData(convert.ToFloat64(datapoint.Minimum)), "average": llx.FloatData(convert.ToFloat64(datapoint.Average)), diff --git a/providers/aws/resources/aws_ec2.go b/providers/aws/resources/aws_ec2.go index 34564fff6c..62db92eb53 100644 --- a/providers/aws/resources/aws_ec2.go +++ b/providers/aws/resources/aws_ec2.go @@ -724,7 +724,7 @@ func (a *mqlAwsEc2) gatherInstanceInfo(instances []ec2types.Reservation, imdsvVe "ebsOptimized": llx.BoolData(convert.ToBool(instance.EbsOptimized)), "instanceType": llx.StringData(string(instance.InstanceType)), "tags": llx.MapData(Ec2TagsToMap(instance.Tags), types.String), - "launchTime": llx.TimeData(toTime(instance.LaunchTime)), + "launchTime": llx.TimeDataPtr(instance.LaunchTime), "privateIp": llx.StringData(convert.ToString(instance.PrivateIpAddress)), "privateDnsName": llx.StringData(convert.ToString(instance.PrivateDnsName)), "stateTransitionTime": llx.TimeData(stateTransitionTime), @@ -1039,7 +1039,7 @@ func (a *mqlAwsEc2) getVolumes(conn *connection.AwsConnection) []*jobpool.Job { "tags": llx.MapData(Ec2TagsToMap(vol.Tags), types.String), "availabilityZone": llx.StringData(convert.ToString(vol.AvailabilityZone)), "volumeType": llx.StringData(string(vol.VolumeType)), - "createTime": llx.TimeData(toTime(vol.CreateTime)), + "createTime": llx.TimeDataPtr(vol.CreateTime), "region": llx.StringData(regionVal), }) if err != nil { @@ -1324,7 +1324,7 @@ func (a *mqlAwsEc2) getSnapshots(conn *connection.AwsConnection) []*jobpool.Job "id": llx.StringData(convert.ToString(snapshot.SnapshotId)), "region": llx.StringData(regionVal), "volumeId": llx.StringData(convert.ToString(snapshot.VolumeId)), - "startTime": llx.TimeData(toTime(snapshot.StartTime)), + "startTime": llx.TimeDataPtr(snapshot.StartTime), "tags": llx.MapData(Ec2TagsToMap(snapshot.Tags), types.String), "state": llx.StringData(string(snapshot.State)), }) diff --git a/providers/aws/resources/aws_eks.go b/providers/aws/resources/aws_eks.go index 30865325c9..bbf992d5a4 100644 --- a/providers/aws/resources/aws_eks.go +++ b/providers/aws/resources/aws_eks.go @@ -99,7 +99,7 @@ func (a *mqlAwsEks) getClusters(conn *connection.AwsConnection) []*jobpool.Job { "tags": llx.MapData(strMapToInterface(cluster.Tags), types.String), "status": llx.StringData(string(cluster.Status)), "encryptionConfig": llx.ArrayData(encryptionConfig, types.Any), - "createdAt": llx.TimeData(toTime(cluster.CreatedAt)), + "createdAt": llx.TimeDataPtr(cluster.CreatedAt), "endpoint": llx.StringData(convert.ToString(cluster.Endpoint)), "logging": llx.MapData(logging, types.Any), "networkConfig": llx.MapData(kubernetesNetworkConfig, types.Any), diff --git a/providers/aws/resources/aws_elasticache.go b/providers/aws/resources/aws_elasticache.go index ed70c815db..b735823450 100644 --- a/providers/aws/resources/aws_elasticache.go +++ b/providers/aws/resources/aws_elasticache.go @@ -180,9 +180,9 @@ func (a *mqlAwsElasticache) getCacheClusters(conn *connection.AwsConnection) []* "arn": llx.StringData(convert.ToString(cluster.ARN)), "atRestEncryptionEnabled": llx.BoolData(convert.ToBool(cluster.AtRestEncryptionEnabled)), "authTokenEnabled": llx.BoolData(convert.ToBool(cluster.AuthTokenEnabled)), - "authTokenLastModifiedDate": llx.TimeData(toTime(cluster.AuthTokenLastModifiedDate)), + "authTokenLastModifiedDate": llx.TimeDataPtr(cluster.AuthTokenLastModifiedDate), "autoMinorVersionUpgrade": llx.BoolData(cluster.AutoMinorVersionUpgrade), - "cacheClusterCreateTime": llx.TimeData(toTime(cluster.CacheClusterCreateTime)), + "cacheClusterCreateTime": llx.TimeDataPtr(cluster.CacheClusterCreateTime), "cacheClusterId": llx.StringData(convert.ToString(cluster.CacheClusterId)), "cacheClusterStatus": llx.StringData(convert.ToString(cluster.CacheClusterStatus)), "cacheNodeType": llx.StringData(convert.ToString(cluster.CacheNodeType)), diff --git a/providers/aws/resources/aws_elb.go b/providers/aws/resources/aws_elb.go index 509ce7850c..9c5a3b52e6 100644 --- a/providers/aws/resources/aws_elb.go +++ b/providers/aws/resources/aws_elb.go @@ -73,9 +73,11 @@ func (a *mqlAwsElb) getClassicLoadBalancers(conn *connection.AwsConnection) []*j map[string]*llx.RawData{ "arn": llx.StringData(fmt.Sprintf(elbv1LbArnPattern, regionVal, conn.AccountId(), convert.ToString(lb.LoadBalancerName))), "listenerDescriptions": llx.AnyData(jsonListeners), - "dnsName": llx.StringData(convert.ToString(lb.DNSName)), - "name": llx.StringData(convert.ToString(lb.LoadBalancerName)), - "scheme": llx.StringData(convert.ToString(lb.Scheme)), + "dnsName": llx.StringDataPtr(lb.DNSName), + "name": llx.StringDataPtr(lb.LoadBalancerName), + "scheme": llx.StringDataPtr(lb.Scheme), + "vpcId": llx.StringDataPtr(lb.VPCId), + "createdTime": llx.TimeDataPtr(lb.CreatedTime), }) if err != nil { return nil, err @@ -144,10 +146,12 @@ func (a *mqlAwsElb) getLoadBalancers(conn *connection.AwsConnection) []*jobpool. for _, lb := range lbs.LoadBalancers { mqlLb, err := CreateResource(a.MqlRuntime, "aws.elb.loadbalancer", map[string]*llx.RawData{ - "arn": llx.StringData(convert.ToString(lb.LoadBalancerArn)), - "dnsName": llx.StringData(convert.ToString(lb.DNSName)), - "name": llx.StringData(convert.ToString(lb.LoadBalancerName)), - "scheme": llx.StringData(string(lb.Scheme)), + "arn": llx.StringData(convert.ToString(lb.LoadBalancerArn)), + "dnsName": llx.StringData(convert.ToString(lb.DNSName)), + "name": llx.StringData(convert.ToString(lb.LoadBalancerName)), + "scheme": llx.StringData(string(lb.Scheme)), + "vpcId": llx.StringDataPtr(lb.VpcId), + "createdTime": llx.TimeDataPtr(lb.CreatedTime), }) if err != nil { return nil, err diff --git a/providers/aws/resources/aws_iam.go b/providers/aws/resources/aws_iam.go index b97bd979ca..e1bcb2ca0c 100644 --- a/providers/aws/resources/aws_iam.go +++ b/providers/aws/resources/aws_iam.go @@ -273,8 +273,8 @@ func (a *mqlAwsIam) createIamUser(usr *iamtypes.User) (plugin.Resource, error) { "arn": llx.StringData(convert.ToString(usr.Arn)), "id": llx.StringData(convert.ToString(usr.UserId)), "name": llx.StringData(convert.ToString(usr.UserName)), - "createDate": llx.TimeData(toTime(usr.CreateDate)), - "passwordLastUsed": llx.TimeData(toTime(usr.PasswordLastUsed)), + "createDate": llx.TimeDataPtr(usr.CreateDate), + "passwordLastUsed": llx.TimeDataPtr(usr.PasswordLastUsed), "tags": llx.MapData(iamTagsToMap(usr.Tags), types.String), }, ) @@ -342,8 +342,8 @@ func (a *mqlAwsIam) mqlPolicies(policies []iamtypes.Policy) ([]interface{}, erro "description": llx.StringData(convert.ToString(policy.Description)), "isAttachable": llx.BoolData(policy.IsAttachable), "attachmentCount": llx.IntData(convert.ToInt64From32(policy.AttachmentCount)), - "createDate": llx.TimeData(toTime(policy.CreateDate)), - "updateDate": llx.TimeData(toTime(policy.UpdateDate)), + "createDate": llx.TimeDataPtr(policy.CreateDate), + "updateDate": llx.TimeDataPtr(policy.UpdateDate), }) if err != nil { return nil, err @@ -443,7 +443,7 @@ func (a *mqlAwsIam) roles() ([]interface{}, error) { "name": llx.StringData(convert.ToString(role.RoleName)), "description": llx.StringData(convert.ToString(role.Description)), "tags": llx.MapData(iamTagsToMap(role.Tags), types.String), - "createDate": llx.TimeData(toTime(role.CreateDate)), + "createDate": llx.TimeDataPtr(role.CreateDate), }) if err != nil { return nil, err @@ -733,8 +733,8 @@ func initAwsIamUser(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[ args["arn"] = llx.StringData(convert.ToString(usr.Arn)) args["id"] = llx.StringData(convert.ToString(usr.UserId)) args["name"] = llx.StringData(convert.ToString(usr.UserName)) - args["createDate"] = llx.TimeData(toTime(usr.CreateDate)) - args["passwordLastUsed"] = llx.TimeData(toTime(usr.PasswordLastUsed)) + args["createDate"] = llx.TimeDataPtr(usr.CreateDate) + args["passwordLastUsed"] = llx.TimeDataPtr(usr.PasswordLastUsed) args["tags"] = llx.MapData(iamTagsToMap(usr.Tags), types.String) return args, nil, nil @@ -1102,7 +1102,7 @@ func (a *mqlAwsIamPolicy) defaultVersion() (*mqlAwsIamPolicyversion, error) { "arn": llx.StringData(arn), "versionId": llx.StringData(convert.ToString(policyversion.VersionId)), "isDefaultVersion": llx.BoolData(policyversion.IsDefaultVersion), - "createDate": llx.TimeData(toTime(policyversion.CreateDate)), + "createDate": llx.TimeDataPtr(policyversion.CreateDate), }) if err != nil { return nil, err @@ -1135,7 +1135,7 @@ func (a *mqlAwsIamPolicy) versions() ([]interface{}, error) { "arn": llx.StringData(arn), "versionId": llx.StringData(convert.ToString(policyversion.VersionId)), "isDefaultVersion": llx.BoolData(policyversion.IsDefaultVersion), - "createDate": llx.TimeData(toTime(policyversion.CreateDate)), + "createDate": llx.TimeDataPtr(policyversion.CreateDate), }) if err != nil { return nil, err @@ -1220,7 +1220,7 @@ func initAwsIamRole(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[ args["name"] = llx.StringData(convert.ToString(role.RoleName)) args["description"] = llx.StringData(convert.ToString(role.Description)) args["tags"] = llx.MapData(iamTagsToMap(role.Tags), types.String) - args["createDate"] = llx.TimeData(toTime(role.CreateDate)) + args["createDate"] = llx.TimeDataPtr(role.CreateDate) return args, nil, nil } @@ -1267,7 +1267,7 @@ func initAwsIamGroup(runtime *plugin.Runtime, args map[string]*llx.RawData) (map args["arn"] = llx.StringData(convert.ToString(grp.Arn)) args["id"] = llx.StringData(convert.ToString(grp.GroupId)) args["name"] = llx.StringData(convert.ToString(grp.GroupName)) - args["createDate"] = llx.TimeData(toTime(grp.CreateDate)) + args["createDate"] = llx.TimeDataPtr(grp.CreateDate) args["usernames"] = llx.ArrayData(usernames, types.String) return args, nil, nil } diff --git a/providers/aws/resources/aws_rds.go b/providers/aws/resources/aws_rds.go index ad7c0930d1..b0e1c9e2b9 100644 --- a/providers/aws/resources/aws_rds.go +++ b/providers/aws/resources/aws_rds.go @@ -112,7 +112,7 @@ func (a *mqlAwsRds) getDbInstances(conn *connection.AwsConnection) []*jobpool.Jo "storageType": llx.StringData(convert.ToString(dbInstance.StorageType)), "storageIops": llx.IntData(convert.ToInt64From32(dbInstance.Iops)), "tags": llx.MapData(rdsTagsToMap(dbInstance.TagList), types.String), - "creationDate": llx.TimeData(toTime(dbInstance.InstanceCreateTime)), + "createdTime": llx.TimeDataPtr(dbInstance.InstanceCreateTime), }) if err != nil { return nil, err diff --git a/providers/aws/resources/aws_s3.go b/providers/aws/resources/aws_s3.go index 9314484ed7..517cecb04c 100644 --- a/providers/aws/resources/aws_s3.go +++ b/providers/aws/resources/aws_s3.go @@ -83,11 +83,11 @@ func (a *mqlAwsS3) buckets() ([]interface{}, error) { } mqlS3Bucket, err := CreateResource(a.MqlRuntime, "aws.s3.bucket", map[string]*llx.RawData{ - "name": llx.StringData(convert.ToString(bucket.Name)), - "arn": llx.StringData(fmt.Sprintf(s3ArnPattern, convert.ToString(bucket.Name))), - "exists": llx.BoolData(true), - "location": llx.StringData(region), - "creationDate": llx.TimeData(toTime(bucket.CreationDate)), + "name": llx.StringData(convert.ToString(bucket.Name)), + "arn": llx.StringData(fmt.Sprintf(s3ArnPattern, convert.ToString(bucket.Name))), + "exists": llx.BoolData(true), + "location": llx.StringData(region), + "createdTime": llx.TimeDataPtr(bucket.CreationDate), }) if err != nil { return nil, err diff --git a/providers/aws/resources/shared.go b/providers/aws/resources/shared.go index 7d3c7d2ebf..703999c697 100644 --- a/providers/aws/resources/shared.go +++ b/providers/aws/resources/shared.go @@ -10,7 +10,6 @@ import ( "errors" "io" "strings" - "time" "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/smithy-go/transport/http" @@ -66,13 +65,6 @@ func Is400AccessDeniedError(err error) bool { return false } -func toTime(s *time.Time) time.Time { - if s == nil { - return time.Time{} - } - return *s -} - func strMapToInterface(m map[string]string) map[string]interface{} { res := map[string]interface{}{} for k, v := range m {