2021-02-24 12:55:26 +00:00
|
|
|
package github
|
|
|
|
|
2022-06-28 07:23:29 +00:00
|
|
|
import (
|
|
|
|
"github.com/snyk/driftctl/enumeration/resource"
|
2022-07-21 13:08:43 +00:00
|
|
|
dctlresource "github.com/snyk/driftctl/pkg/resource"
|
2022-06-28 07:23:29 +00:00
|
|
|
)
|
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) {
|
2021-05-24 15:19:06 +00:00
|
|
|
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
|
|
|
}
|