driftctl/pkg/resource/github/github_team.go

29 lines
1001 B
Go
Raw Normal View History

2021-02-24 12:55:26 +00:00
package github
import (
"github.com/snyk/driftctl/enumeration/resource"
2022-07-21 13:08:43 +00:00
dctlresource "github.com/snyk/driftctl/pkg/resource"
)
2021-02-24 12:55:26 +00:00
2022-07-21 08:37:03 +00:00
const GithubTeamResourceType = "github_team"
2022-07-21 13:08:43 +00:00
func initGithubTeamMetaData(resourceSchemaRepository dctlresource.SchemaRepositoryInterface) {
2022-07-21 08:37:03 +00:00
resourceSchemaRepository.SetNormalizeFunc(GithubTeamResourceType, func(res *resource.Resource) {
val := res.Attrs
2021-05-11 12:32:33 +00:00
if defaultMaintainer, exist := val.Get("create_default_maintainer"); !exist || defaultMaintainer == nil {
(*val)["create_default_maintainer"] = false
}
val.SafeDelete([]string{"etag"})
})
2022-07-21 08:37:03 +00:00
resourceSchemaRepository.SetHumanReadableAttributesFunc(GithubTeamResourceType, func(res *resource.Resource) map[string]string {
val := res.Attrs
attrs := make(map[string]string)
attrs["Id"] = res.ResourceId()
if name := val.GetString("name"); name != nil && *name != "" {
attrs["Name"] = *name
}
return attrs
})
resourceSchemaRepository.SetFlags(GithubTeamResourceType, resource.FlagDeepMode)
2021-05-11 12:32:33 +00:00
}