Skip to content

Commit

Permalink
hashicorp#25992 add expand fns
Browse files Browse the repository at this point in the history
  • Loading branch information
nick committed Jul 27, 2022
1 parent 5217bbe commit 77d2ea4
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions internal/service/guardduty/organization_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,60 @@ func expandOrganizationKubernetesConfiguration(tfMap map[string]interface{}) *gu
}
}

func expandOrganizationMalwareProtectionConfiguration(tfMap map[string]interface{}) *guardduty.OrganizationMalwareProtectionConfiguration {
if tfMap == nil {
return nil
}

l, ok := tfMap["scan_ec2_instance_with_findings"].([]interface{})
if !ok || len(l) == 0 {
return nil
}

m, ok := l[0].(map[string]interface{})
if !ok {
return nil
}

return &guardduty.OrganizationMalwareProtectionConfiguration{
ScanEc2InstanceWithFindings: expandOrganizationScanEC2InstanceWithFindingsConfiguration(m),
}
}

func expandOrganizationScanEC2InstanceWithFindingsConfiguration(tfMap map[string]interface{}) *guardduty.OrganizationScanEc2InstanceWithFindings {
if tfMap == nil {
return nil
}

l, ok := tfMap["ebs_volumes"].([]interface{})
if !ok || len(l) == 0 {
return nil
}

m, ok := l[0].(map[string]interface{})
if !ok {
return nil
}

return &guardduty.OrganizationScanEc2InstanceWithFindings{
EbsVolumes: expandOrganizationEBSVolumesConfiguration(m),
}
}

func expandOrganizationEBSVolumesConfiguration(tfMap map[string]interface{}) *guardduty.OrganizationEbsVolumes {
if tfMap == nil {
return nil
}

apiObject := &guardduty.OrganizationEbsVolumes{}

if v, ok := tfMap["auto_enable"].(bool); ok {
apiObject.AutoEnable = aws.Bool(v)
}

return apiObject
}

func expandOrganizationKubernetesAuditLogsConfiguration(tfMap map[string]interface{}) *guardduty.OrganizationKubernetesAuditLogsConfiguration {
if tfMap == nil {
return nil
Expand Down

0 comments on commit 77d2ea4

Please sign in to comment.