-
Notifications
You must be signed in to change notification settings - Fork 221
/
structure_logging_custom_target_config.go
67 lines (50 loc) · 1.33 KB
/
structure_logging_custom_target_config.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
package rancher2
import (
managementClient "github.com/rancher/rancher/pkg/client/generated/management/v3"
)
// Flatteners
func flattenLoggingCustomTargetConfig(in *managementClient.CustomTargetConfig, p []interface{}) ([]interface{}, error) {
var obj map[string]interface{}
if len(p) == 0 || p[0] == nil {
obj = make(map[string]interface{})
} else {
obj = p[0].(map[string]interface{})
}
if in == nil {
return []interface{}{}, nil
}
if len(in.Certificate) > 0 {
obj["certificate"] = in.Certificate
}
if len(in.ClientCert) > 0 {
obj["client_cert"] = in.ClientCert
}
if len(in.ClientKey) > 0 {
obj["client_key"] = in.ClientKey
}
if len(in.Content) > 0 {
obj["content"] = in.Content
}
return []interface{}{obj}, nil
}
// Expanders
func expandLoggingCustomTargetConfig(p []interface{}) (*managementClient.CustomTargetConfig, error) {
obj := &managementClient.CustomTargetConfig{}
if len(p) == 0 || p[0] == nil {
return obj, nil
}
in := p[0].(map[string]interface{})
if v, ok := in["certificate"].(string); ok && len(v) > 0 {
obj.Certificate = v
}
if v, ok := in["client_cert"].(string); ok && len(v) > 0 {
obj.ClientCert = v
}
if v, ok := in["client_key"].(string); ok && len(v) > 0 {
obj.ClientKey = v
}
if v, ok := in["content"].(string); ok && len(v) > 0 {
obj.Content = v
}
return obj, nil
}