driftctl/pkg/resource/aws/aws_lambda_event_source_map...

33 lines
1.3 KiB
Go
Raw Permalink Normal View History

package aws
2022-07-21 13:08:43 +00:00
import (
"github.com/snyk/driftctl/enumeration/resource"
dctlresource "github.com/snyk/driftctl/pkg/resource"
)
2022-07-21 08:37:03 +00:00
const AwsLambdaEventSourceMappingResourceType = "aws_lambda_event_source_mapping"
2021-03-25 11:13:52 +00:00
2022-07-21 13:08:43 +00:00
func initAwsLambdaEventSourceMappingMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
2022-07-21 08:37:03 +00:00
resourceSchemaRepository.SetNormalizeFunc(AwsLambdaEventSourceMappingResourceType, func(res *resource.Resource) {
val := res.Attrs
2021-05-18 12:54:01 +00:00
val.SafeDelete([]string{"state_transition_reason"})
val.SafeDelete([]string{"state"})
val.SafeDelete([]string{"starting_position_timestamp"})
val.SafeDelete([]string{"starting_position"})
val.SafeDelete([]string{"last_processing_result"})
val.SafeDelete([]string{"last_modified"})
})
2022-07-21 08:37:03 +00:00
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsLambdaEventSourceMappingResourceType, func(res *resource.Resource) map[string]string {
val := res.Attrs
attrs := make(map[string]string)
source := val.GetString("event_source_arn")
dest := val.GetString("function_name")
if source != nil && *source != "" && dest != nil && *dest != "" {
attrs["Source"] = *source
attrs["Dest"] = *dest
}
return attrs
})
resourceSchemaRepository.SetFlags(AwsLambdaEventSourceMappingResourceType, resource.FlagDeepMode)
2021-05-18 12:54:01 +00:00
}