Skip to content

Commit a1c45cd

Browse files
author
张哲铭
committed
feat: tls index add user innner key value
1 parent 9a1084e commit a1c45cd

File tree

5 files changed

+258
-86
lines changed

5 files changed

+258
-86
lines changed

example/dataTlsIndexes/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
data "volcengine_tls_indexes" "default" {
2-
ids = ["65d67d34-c5b4-4ec8-b3a9-175d3366****"]
2+
ids = ["7ce12237-6670-44a7-9d79-2e36961586e6"]
33
}

example/tlsIndex/main.tf

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
resource "volcengine_tls_index" "foo" {
2-
topic_id = "65d67d34-c5b4-4ec8-b3a9-175d3366****"
2+
topic_id = "7ce12237-6670-44a7-9d79-2e36961586e6"
33

4-
full_text {
5-
case_sensitive = true
6-
delimiter = "!"
7-
include_chinese = false
8-
}
4+
# full_text {
5+
# case_sensitive = true
6+
# delimiter = "!"
7+
# include_chinese = false
8+
# }
99

1010
key_value {
1111
key = "k1"
@@ -15,11 +15,11 @@ resource "volcengine_tls_index" "foo" {
1515
include_chinese = false
1616
sql_flag = false
1717
json_keys {
18-
key = "k2.k4"
18+
key = "class"
1919
value_type = "text"
2020
}
2121
json_keys {
22-
key = "k3.k4"
22+
key = "age"
2323
value_type = "long"
2424
}
2525
}
@@ -32,4 +32,21 @@ resource "volcengine_tls_index" "foo" {
3232
include_chinese = false
3333
sql_flag = false
3434
}
35+
36+
user_inner_key_value {
37+
key = "__content__"
38+
value_type = "json"
39+
delimiter = ",:-/ "
40+
case_sensitive = false
41+
include_chinese = false
42+
sql_flag = false
43+
json_keys {
44+
key = "age"
45+
value_type = "long"
46+
}
47+
json_keys {
48+
key = "name"
49+
value_type = "long"
50+
}
51+
}
3552
}

volcengine/tls/index/data_source_volcengine_tls_indexes.go

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,84 @@ func DataSourceVolcengineTlsIndexes() *schema.Resource {
157157
},
158158
},
159159
},
160+
"user_inner_key_value": {
161+
Type: schema.TypeList,
162+
Computed: true,
163+
Description: "The reserved field index configuration of the tls topic.",
164+
Elem: &schema.Resource{
165+
Schema: map[string]*schema.Schema{
166+
"key": {
167+
Type: schema.TypeString,
168+
Computed: true,
169+
Description: "The key of the KeyValue index.",
170+
},
171+
"value_type": {
172+
Type: schema.TypeString,
173+
Computed: true,
174+
Description: "The type of value.",
175+
},
176+
"case_sensitive": {
177+
Type: schema.TypeBool,
178+
Computed: true,
179+
Description: "Whether the value is case sensitive.",
180+
},
181+
"delimiter": {
182+
Type: schema.TypeString,
183+
Computed: true,
184+
Description: "The delimiter of the value.",
185+
},
186+
"include_chinese": {
187+
Type: schema.TypeBool,
188+
Computed: true,
189+
Description: "Whether the value include chinese.",
190+
},
191+
"sql_flag": {
192+
Type: schema.TypeBool,
193+
Computed: true,
194+
Description: "Whether the filed is enabled for analysis.",
195+
},
196+
"json_keys": {
197+
Type: schema.TypeList,
198+
Computed: true,
199+
Description: "The JSON subfield key value index.",
200+
Elem: &schema.Resource{
201+
Schema: map[string]*schema.Schema{
202+
"key": {
203+
Type: schema.TypeString,
204+
Computed: true,
205+
Description: "The key of the subfield key value index.",
206+
},
207+
"value_type": {
208+
Type: schema.TypeString,
209+
Computed: true,
210+
Description: "The type of value.",
211+
},
212+
"case_sensitive": {
213+
Type: schema.TypeBool,
214+
Computed: true,
215+
Description: "Whether the value is case sensitive.",
216+
},
217+
"delimiter": {
218+
Type: schema.TypeString,
219+
Computed: true,
220+
Description: "The delimiter of the value.",
221+
},
222+
"include_chinese": {
223+
Type: schema.TypeBool,
224+
Computed: true,
225+
Description: "Whether the value include chinese.",
226+
},
227+
"sql_flag": {
228+
Type: schema.TypeBool,
229+
Computed: true,
230+
Description: "Whether the filed is enabled for analysis.",
231+
},
232+
},
233+
},
234+
},
235+
},
236+
},
237+
},
160238
},
161239
},
162240
},

volcengine/tls/index/resource_volcengine_tls_index.go

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func ResourceVolcengineTlsIndex() *schema.Resource {
6969
},
7070
},
7171
"key_value": {
72-
Type: schema.TypeList,
72+
Type: schema.TypeSet,
7373
Optional: true,
7474
AtLeastOneOf: []string{"full_text", "key_value"},
7575
Description: "The key value info of the tls index.",
@@ -111,7 +111,7 @@ func ResourceVolcengineTlsIndex() *schema.Resource {
111111
Description: "Whether the filed is enabled for analysis.",
112112
},
113113
"json_keys": {
114-
Type: schema.TypeList,
114+
Type: schema.TypeSet,
115115
Optional: true,
116116
//DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
117117
// logger.DebugInfo("testValueType1", k)
@@ -145,7 +145,70 @@ func ResourceVolcengineTlsIndex() *schema.Resource {
145145
},
146146
},
147147
},
148-
148+
"user_inner_key_value": {
149+
Type: schema.TypeSet,
150+
Optional: true,
151+
Description: "The reserved field index configuration of the tls index.",
152+
Elem: &schema.Resource{
153+
Schema: map[string]*schema.Schema{
154+
"key": {
155+
Type: schema.TypeString,
156+
Required: true,
157+
Description: "The key of the KeyValueInfo.",
158+
},
159+
"value_type": {
160+
Type: schema.TypeString,
161+
Required: true,
162+
ValidateFunc: validation.StringInSlice([]string{"long", "double", "text", "json"}, false),
163+
Description: "The type of value. Valid values: `long`, `double`, `text`, `json`.",
164+
},
165+
"case_sensitive": {
166+
Type: schema.TypeBool,
167+
Optional: true,
168+
Default: false,
169+
Description: "Whether the value is case sensitive.",
170+
},
171+
"delimiter": {
172+
Type: schema.TypeString,
173+
Optional: true,
174+
Default: "",
175+
Description: "The delimiter of the value.",
176+
},
177+
"include_chinese": {
178+
Type: schema.TypeBool,
179+
Optional: true,
180+
Default: false,
181+
Description: "Whether the value include chinese.",
182+
},
183+
"sql_flag": {
184+
Type: schema.TypeBool,
185+
Optional: true,
186+
Default: false,
187+
Description: "Whether the filed is enabled for analysis.",
188+
},
189+
"json_keys": {
190+
Type: schema.TypeSet,
191+
Optional: true,
192+
Description: "The JSON subfield key value index.",
193+
Elem: &schema.Resource{
194+
Schema: map[string]*schema.Schema{
195+
"key": {
196+
Type: schema.TypeString,
197+
Required: true,
198+
Description: "The key of the subfield key value index.",
199+
},
200+
"value_type": {
201+
Type: schema.TypeString,
202+
Required: true,
203+
ValidateFunc: validation.StringInSlice([]string{"long", "double", "text"}, false),
204+
Description: "The type of value. Valid values: `long`, `double`, `text`.",
205+
},
206+
},
207+
},
208+
},
209+
},
210+
},
211+
},
149212
"create_time": {
150213
Type: schema.TypeString,
151214
Computed: true,

0 commit comments

Comments
 (0)