/
DataSource_TopologySpec.generated.go
111 lines (104 loc) · 3.07 KB
/
DataSource_TopologySpec.generated.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package schemas
import (
. "github.com/eddycharly/terraform-provider-kops/pkg/schemas"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"k8s.io/kops/pkg/apis/kops"
)
var _ = Schema
func DataSourceTopologySpec() *schema.Resource {
res := &schema.Resource{
Schema: map[string]*schema.Schema{
"masters": ComputedString(),
"nodes": ComputedString(),
"bastion": ComputedStruct(DataSourceBastionSpec()),
"dns": ComputedStruct(DataSourceDNSSpec()),
},
}
return res
}
func ExpandDataSourceTopologySpec(in map[string]interface{}) kops.TopologySpec {
if in == nil {
panic("expand TopologySpec failure, in is nil")
}
return kops.TopologySpec{
Masters: func(in interface{}) string {
return string(ExpandString(in))
}(in["masters"]),
Nodes: func(in interface{}) string {
return string(ExpandString(in))
}(in["nodes"]),
Bastion: func(in interface{}) *kops.BastionSpec {
return func(in interface{}) *kops.BastionSpec {
if in == nil {
return nil
}
if _, ok := in.([]interface{}); ok && len(in.([]interface{})) == 0 {
return nil
}
return func(in kops.BastionSpec) *kops.BastionSpec {
return &in
}(func(in interface{}) kops.BastionSpec {
if in, ok := in.([]interface{}); ok && len(in) == 1 && in[0] != nil {
return ExpandDataSourceBastionSpec(in[0].(map[string]interface{}))
}
return kops.BastionSpec{}
}(in))
}(in)
}(in["bastion"]),
DNS: func(in interface{}) *kops.DNSSpec {
return func(in interface{}) *kops.DNSSpec {
if in == nil {
return nil
}
if _, ok := in.([]interface{}); ok && len(in.([]interface{})) == 0 {
return nil
}
return func(in kops.DNSSpec) *kops.DNSSpec {
return &in
}(func(in interface{}) kops.DNSSpec {
if in, ok := in.([]interface{}); ok && len(in) == 1 && in[0] != nil {
return ExpandDataSourceDNSSpec(in[0].(map[string]interface{}))
}
return kops.DNSSpec{}
}(in))
}(in)
}(in["dns"]),
}
}
func FlattenDataSourceTopologySpecInto(in kops.TopologySpec, out map[string]interface{}) {
out["masters"] = func(in string) interface{} {
return FlattenString(string(in))
}(in.Masters)
out["nodes"] = func(in string) interface{} {
return FlattenString(string(in))
}(in.Nodes)
out["bastion"] = func(in *kops.BastionSpec) interface{} {
return func(in *kops.BastionSpec) interface{} {
if in == nil {
return nil
}
return func(in kops.BastionSpec) interface{} {
return func(in kops.BastionSpec) []interface{} {
return []interface{}{FlattenDataSourceBastionSpec(in)}
}(in)
}(*in)
}(in)
}(in.Bastion)
out["dns"] = func(in *kops.DNSSpec) interface{} {
return func(in *kops.DNSSpec) interface{} {
if in == nil {
return nil
}
return func(in kops.DNSSpec) interface{} {
return func(in kops.DNSSpec) []interface{} {
return []interface{}{FlattenDataSourceDNSSpec(in)}
}(in)
}(*in)
}(in)
}(in.DNS)
}
func FlattenDataSourceTopologySpec(in kops.TopologySpec) map[string]interface{} {
out := map[string]interface{}{}
FlattenDataSourceTopologySpecInto(in, out)
return out
}