forked from hashicorp/terraform-provider-google
/
tpgtools_custom_flattens.go
41 lines (33 loc) · 1.26 KB
/
tpgtools_custom_flattens.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package tpgresource
import (
containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws"
containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)
func FlattenContainerAwsNodePoolManagement(obj *containeraws.NodePoolManagement, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if obj == nil {
return nil
}
transformed := make(map[string]interface{})
if obj.AutoRepair == nil || obj.Empty() {
transformed["auto_repair"] = false
} else {
transformed["auto_repair"] = obj.AutoRepair
}
return []interface{}{transformed}
}
func FlattenContainerAzureNodePoolManagement(obj *containerazure.NodePoolManagement, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if obj == nil {
return nil
}
transformed := make(map[string]interface{})
if obj.AutoRepair == nil || obj.Empty() {
transformed["auto_repair"] = false
} else {
transformed["auto_repair"] = obj.AutoRepair
}
return []interface{}{transformed}
}