This repository has been archived by the owner on May 15, 2023. It is now read-only.
/
dialogflow_intent.go
163 lines (145 loc) · 6.68 KB
/
dialogflow_intent.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package google
import "reflect"
const DialogflowIntentAssetType string = "dialogflow.googleapis.com/Intent"
func resourceConverterDialogflowIntent() ResourceConverter {
return ResourceConverter{
AssetType: DialogflowIntentAssetType,
Convert: GetDialogflowIntentCaiObject,
}
}
func GetDialogflowIntentCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
name, err := assetName(d, config, "//dialogflow.googleapis.com/{{name}}")
if err != nil {
return []Asset{}, err
}
if obj, err := GetDialogflowIntentApiObject(d, config); err == nil {
return []Asset{{
Name: name,
Type: DialogflowIntentAssetType,
Resource: &AssetResource{
Version: "v2",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/dialogflow/v2/rest",
DiscoveryName: "Intent",
Data: obj,
},
}}, nil
} else {
return []Asset{}, err
}
}
func GetDialogflowIntentApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
displayNameProp, err := expandDialogflowIntentDisplayName(d.Get("display_name"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
obj["displayName"] = displayNameProp
}
webhookStateProp, err := expandDialogflowIntentWebhookState(d.Get("webhook_state"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("webhook_state"); !isEmptyValue(reflect.ValueOf(webhookStateProp)) && (ok || !reflect.DeepEqual(v, webhookStateProp)) {
obj["webhookState"] = webhookStateProp
}
priorityProp, err := expandDialogflowIntentPriority(d.Get("priority"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("priority"); !isEmptyValue(reflect.ValueOf(priorityProp)) && (ok || !reflect.DeepEqual(v, priorityProp)) {
obj["priority"] = priorityProp
}
isFallbackProp, err := expandDialogflowIntentIsFallback(d.Get("is_fallback"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("is_fallback"); !isEmptyValue(reflect.ValueOf(isFallbackProp)) && (ok || !reflect.DeepEqual(v, isFallbackProp)) {
obj["isFallback"] = isFallbackProp
}
mlDisabledProp, err := expandDialogflowIntentMlDisabled(d.Get("ml_disabled"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("ml_disabled"); !isEmptyValue(reflect.ValueOf(mlDisabledProp)) && (ok || !reflect.DeepEqual(v, mlDisabledProp)) {
obj["mlDisabled"] = mlDisabledProp
}
inputContextNamesProp, err := expandDialogflowIntentInputContextNames(d.Get("input_context_names"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("input_context_names"); !isEmptyValue(reflect.ValueOf(inputContextNamesProp)) && (ok || !reflect.DeepEqual(v, inputContextNamesProp)) {
obj["inputContextNames"] = inputContextNamesProp
}
eventsProp, err := expandDialogflowIntentEvents(d.Get("events"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("events"); !isEmptyValue(reflect.ValueOf(eventsProp)) && (ok || !reflect.DeepEqual(v, eventsProp)) {
obj["events"] = eventsProp
}
actionProp, err := expandDialogflowIntentAction(d.Get("action"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("action"); !isEmptyValue(reflect.ValueOf(actionProp)) && (ok || !reflect.DeepEqual(v, actionProp)) {
obj["action"] = actionProp
}
resetContextsProp, err := expandDialogflowIntentResetContexts(d.Get("reset_contexts"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("reset_contexts"); !isEmptyValue(reflect.ValueOf(resetContextsProp)) && (ok || !reflect.DeepEqual(v, resetContextsProp)) {
obj["resetContexts"] = resetContextsProp
}
defaultResponsePlatformsProp, err := expandDialogflowIntentDefaultResponsePlatforms(d.Get("default_response_platforms"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("default_response_platforms"); !isEmptyValue(reflect.ValueOf(defaultResponsePlatformsProp)) && (ok || !reflect.DeepEqual(v, defaultResponsePlatformsProp)) {
obj["defaultResponsePlatforms"] = defaultResponsePlatformsProp
}
parentFollowupIntentNameProp, err := expandDialogflowIntentParentFollowupIntentName(d.Get("parent_followup_intent_name"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("parent_followup_intent_name"); !isEmptyValue(reflect.ValueOf(parentFollowupIntentNameProp)) && (ok || !reflect.DeepEqual(v, parentFollowupIntentNameProp)) {
obj["parentFollowupIntentName"] = parentFollowupIntentNameProp
}
return obj, nil
}
func expandDialogflowIntentDisplayName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentWebhookState(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentPriority(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentIsFallback(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentMlDisabled(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentInputContextNames(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentEvents(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentAction(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentResetContexts(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentDefaultResponsePlatforms(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
func expandDialogflowIntentParentFollowupIntentName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}