Skip to content

Commit e78439c

Browse files
Added support for defaultSearchHandlingStrict in FHIR Store resource (#8632) (#6078)
* feat: added defaultSearchHandlingStrict bool * chore: removed trailing spaces Signed-off-by: Modular Magician <[email protected]>
1 parent 20d1dec commit e78439c

File tree

4 files changed

+53
-8
lines changed

4 files changed

+53
-8
lines changed

.changelog/8632.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
healthcare: added `defaultSearchHandlingStrict` field to `google_healthcare_fhir_store` resource
3+
```

google-beta/services/healthcare/resource_healthcare_fhir_store.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ func ResourceHealthcareFhirStore() *schema.Resource {
7272
ValidateFunc: verify.ValidateEnum([]string{"COMPLEX_DATA_TYPE_REFERENCE_PARSING_UNSPECIFIED", "DISABLED", "ENABLED", ""}),
7373
Description: `Enable parsing of references within complex FHIR data types such as Extensions. If this value is set to ENABLED, then features like referential integrity and Bundle reference rewriting apply to all references. If this flag has not been specified the behavior of the FHIR store will not change, references in complex data types will not be parsed. New stores will have this value set to ENABLED by default after a notification period. Warning: turning on this flag causes processing existing resources to fail if they contain references to non-existent resources. Possible values: ["COMPLEX_DATA_TYPE_REFERENCE_PARSING_UNSPECIFIED", "DISABLED", "ENABLED"]`,
7474
},
75+
"default_search_handling_strict": {
76+
Type: schema.TypeBool,
77+
Optional: true,
78+
Description: `If true, overrides the default search behavior for this FHIR store to handling=strict which returns an error for unrecognized search parameters.
79+
If false, uses the FHIR specification default handling=lenient which ignores unrecognized search parameters.
80+
The handling can always be changed from the default on an individual API call by setting the HTTP header Prefer: handling=strict or Prefer: handling=lenient.`,
81+
},
7582
"disable_referential_integrity": {
7683
Type: schema.TypeBool,
7784
Optional: true,
@@ -372,6 +379,12 @@ func resourceHealthcareFhirStoreCreate(d *schema.ResourceData, meta interface{})
372379
} else if v, ok := d.GetOkExists("stream_configs"); !tpgresource.IsEmptyValue(reflect.ValueOf(streamConfigsProp)) && (ok || !reflect.DeepEqual(v, streamConfigsProp)) {
373380
obj["streamConfigs"] = streamConfigsProp
374381
}
382+
defaultSearchHandlingStrictProp, err := expandHealthcareFhirStoreDefaultSearchHandlingStrict(d.Get("default_search_handling_strict"), d, config)
383+
if err != nil {
384+
return err
385+
} else if v, ok := d.GetOkExists("default_search_handling_strict"); !tpgresource.IsEmptyValue(reflect.ValueOf(defaultSearchHandlingStrictProp)) && (ok || !reflect.DeepEqual(v, defaultSearchHandlingStrictProp)) {
386+
obj["defaultSearchHandlingStrict"] = defaultSearchHandlingStrictProp
387+
}
375388
notificationConfigsProp, err := expandHealthcareFhirStoreNotificationConfigs(d.Get("notification_configs"), d, config)
376389
if err != nil {
377390
return err
@@ -489,6 +502,9 @@ func resourceHealthcareFhirStoreRead(d *schema.ResourceData, meta interface{}) e
489502
if err := d.Set("stream_configs", flattenHealthcareFhirStoreStreamConfigs(res["streamConfigs"], d, config)); err != nil {
490503
return fmt.Errorf("Error reading FhirStore: %s", err)
491504
}
505+
if err := d.Set("default_search_handling_strict", flattenHealthcareFhirStoreDefaultSearchHandlingStrict(res["defaultSearchHandlingStrict"], d, config)); err != nil {
506+
return fmt.Errorf("Error reading FhirStore: %s", err)
507+
}
492508
if err := d.Set("notification_configs", flattenHealthcareFhirStoreNotificationConfigs(res["notificationConfigs"], d, config)); err != nil {
493509
return fmt.Errorf("Error reading FhirStore: %s", err)
494510
}
@@ -536,6 +552,12 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
536552
} else if v, ok := d.GetOkExists("stream_configs"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, streamConfigsProp)) {
537553
obj["streamConfigs"] = streamConfigsProp
538554
}
555+
defaultSearchHandlingStrictProp, err := expandHealthcareFhirStoreDefaultSearchHandlingStrict(d.Get("default_search_handling_strict"), d, config)
556+
if err != nil {
557+
return err
558+
} else if v, ok := d.GetOkExists("default_search_handling_strict"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, defaultSearchHandlingStrictProp)) {
559+
obj["defaultSearchHandlingStrict"] = defaultSearchHandlingStrictProp
560+
}
539561
notificationConfigsProp, err := expandHealthcareFhirStoreNotificationConfigs(d.Get("notification_configs"), d, config)
540562
if err != nil {
541563
return err
@@ -571,6 +593,10 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
571593
updateMask = append(updateMask, "streamConfigs")
572594
}
573595

596+
if d.HasChange("default_search_handling_strict") {
597+
updateMask = append(updateMask, "defaultSearchHandlingStrict")
598+
}
599+
574600
if d.HasChange("notification_configs") {
575601
updateMask = append(updateMask, "notificationConfigs")
576602
}
@@ -815,6 +841,10 @@ func flattenHealthcareFhirStoreStreamConfigsBigqueryDestinationSchemaConfigLastU
815841
return v
816842
}
817843

844+
func flattenHealthcareFhirStoreDefaultSearchHandlingStrict(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
845+
return v
846+
}
847+
818848
func flattenHealthcareFhirStoreNotificationConfigs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
819849
if v == nil {
820850
return v
@@ -1047,6 +1077,10 @@ func expandHealthcareFhirStoreStreamConfigsBigqueryDestinationSchemaConfigLastUp
10471077
return v, nil
10481078
}
10491079

1080+
func expandHealthcareFhirStoreDefaultSearchHandlingStrict(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
1081+
return v, nil
1082+
}
1083+
10501084
func expandHealthcareFhirStoreNotificationConfigs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
10511085
l := v.([]interface{})
10521086
req := make([]interface{}, 0, len(l))

google-beta/services/healthcare/resource_healthcare_fhir_store_generated_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ resource "google_healthcare_fhir_store" "default" {
6363
version = "R4"
6464
complex_data_type_reference_parsing = "DISABLED"
6565
66-
enable_update_create = false
67-
disable_referential_integrity = false
68-
disable_resource_versioning = false
69-
enable_history_import = false
66+
enable_update_create = false
67+
disable_referential_integrity = false
68+
disable_resource_versioning = false
69+
enable_history_import = false
70+
default_search_handling_strict = false
7071
7172
notification_config {
7273
pubsub_topic = google_pubsub_topic.topic.id

website/docs/r/healthcare_fhir_store.html.markdown

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ resource "google_healthcare_fhir_store" "default" {
4444
version = "R4"
4545
complex_data_type_reference_parsing = "DISABLED"
4646
47-
enable_update_create = false
48-
disable_referential_integrity = false
49-
disable_resource_versioning = false
50-
enable_history_import = false
47+
enable_update_create = false
48+
disable_referential_integrity = false
49+
disable_resource_versioning = false
50+
enable_history_import = false
51+
default_search_handling_strict = false
5152
5253
notification_config {
5354
pubsub_topic = google_pubsub_topic.topic.id
@@ -294,6 +295,12 @@ The following arguments are supported:
294295
the order of dozens of seconds) is expected before the results show up in the streaming destination.
295296
Structure is [documented below](#nested_stream_configs).
296297

298+
* `default_search_handling_strict` -
299+
(Optional)
300+
If true, overrides the default search behavior for this FHIR store to handling=strict which returns an error for unrecognized search parameters.
301+
If false, uses the FHIR specification default handling=lenient which ignores unrecognized search parameters.
302+
The handling can always be changed from the default on an individual API call by setting the HTTP header Prefer: handling=strict or Prefer: handling=lenient.
303+
297304
* `notification_configs` -
298305
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
299306
A list of notifcation configs that configure the notification for every resource mutation in this FHIR store.

0 commit comments

Comments
 (0)