@@ -134,6 +134,14 @@ Only one of 'order' and 'arrayConfig' can be specified. Possible values: ["ASCEN
134
134
},
135
135
},
136
136
},
137
+ "api_scope" : {
138
+ Type : schema .TypeString ,
139
+ Optional : true ,
140
+ ForceNew : true ,
141
+ ValidateFunc : verify .ValidateEnum ([]string {"ANY_API" , "DATASTORE_MODE_API" , "" }),
142
+ Description : `The API scope at which a query is run. Default value: "ANY_API" Possible values: ["ANY_API", "DATASTORE_MODE_API"]` ,
143
+ Default : "ANY_API" ,
144
+ },
137
145
"database" : {
138
146
Type : schema .TypeString ,
139
147
Optional : true ,
@@ -145,8 +153,8 @@ Only one of 'order' and 'arrayConfig' can be specified. Possible values: ["ASCEN
145
153
Type : schema .TypeString ,
146
154
Optional : true ,
147
155
ForceNew : true ,
148
- ValidateFunc : verify .ValidateEnum ([]string {"COLLECTION" , "COLLECTION_GROUP" , "" }),
149
- Description : `The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP"]` ,
156
+ ValidateFunc : verify .ValidateEnum ([]string {"COLLECTION" , "COLLECTION_GROUP" , "COLLECTION_RECURSIVE" , " " }),
157
+ Description : `The scope at which a query is run. Default value: "COLLECTION" Possible values: ["COLLECTION", "COLLECTION_GROUP", "COLLECTION_RECURSIVE" ]` ,
150
158
Default : "COLLECTION" ,
151
159
},
152
160
"name" : {
@@ -192,6 +200,12 @@ func resourceFirestoreIndexCreate(d *schema.ResourceData, meta interface{}) erro
192
200
} else if v , ok := d .GetOkExists ("query_scope" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (queryScopeProp )) && (ok || ! reflect .DeepEqual (v , queryScopeProp )) {
193
201
obj ["queryScope" ] = queryScopeProp
194
202
}
203
+ apiScopeProp , err := expandFirestoreIndexApiScope (d .Get ("api_scope" ), d , config )
204
+ if err != nil {
205
+ return err
206
+ } else if v , ok := d .GetOkExists ("api_scope" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (apiScopeProp )) && (ok || ! reflect .DeepEqual (v , apiScopeProp )) {
207
+ obj ["apiScope" ] = apiScopeProp
208
+ }
195
209
fieldsProp , err := expandFirestoreIndexFields (d .Get ("fields" ), d , config )
196
210
if err != nil {
197
211
return err
@@ -328,6 +342,9 @@ func resourceFirestoreIndexRead(d *schema.ResourceData, meta interface{}) error
328
342
if err := d .Set ("query_scope" , flattenFirestoreIndexQueryScope (res ["queryScope" ], d , config )); err != nil {
329
343
return fmt .Errorf ("Error reading Index: %s" , err )
330
344
}
345
+ if err := d .Set ("api_scope" , flattenFirestoreIndexApiScope (res ["apiScope" ], d , config )); err != nil {
346
+ return fmt .Errorf ("Error reading Index: %s" , err )
347
+ }
331
348
if err := d .Set ("fields" , flattenFirestoreIndexFields (res ["fields" ], d , config )); err != nil {
332
349
return fmt .Errorf ("Error reading Index: %s" , err )
333
350
}
@@ -426,6 +443,14 @@ func flattenFirestoreIndexQueryScope(v interface{}, d *schema.ResourceData, conf
426
443
return v
427
444
}
428
445
446
+ func flattenFirestoreIndexApiScope (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
447
+ if v == nil || tpgresource .IsEmptyValue (reflect .ValueOf (v )) {
448
+ return "ANY_API"
449
+ }
450
+
451
+ return v
452
+ }
453
+
429
454
func flattenFirestoreIndexFields (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
430
455
if v == nil {
431
456
return v
@@ -470,6 +495,10 @@ func expandFirestoreIndexQueryScope(v interface{}, d tpgresource.TerraformResour
470
495
return v , nil
471
496
}
472
497
498
+ func expandFirestoreIndexApiScope (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
499
+ return v , nil
500
+ }
501
+
473
502
func expandFirestoreIndexFields (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
474
503
l := v .([]interface {})
475
504
req := make ([]interface {}, 0 , len (l ))
0 commit comments