Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for complexDataTypeReferenceParsing in FHIR Stores #15159

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/8316.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
healthcare: added `complex_data_type_reference_parsing ` field to `google_healthcare_fhir_store` resource
```
1 change: 1 addition & 0 deletions google/resource_healthcare_fhir_store_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ resource "google_healthcare_fhir_store" "default" {
name = "tf-test-example-fhir-store%{random_suffix}"
dataset = google_healthcare_dataset.dataset.id
version = "R4"
complex_data_type_reference_parsing = "DISABLED"

enable_update_create = false
disable_referential_integrity = false
Expand Down
34 changes: 34 additions & 0 deletions google/services/healthcare/resource_healthcare_fhir_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func ResourceHealthcareFhirStore() *schema.Resource {
ValidateFunc: verify.ValidateEnum([]string{"DSTU2", "STU3", "R4"}),
Description: `The FHIR specification version. Possible values: ["DSTU2", "STU3", "R4"]`,
},
"complex_data_type_reference_parsing": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"COMPLEX_DATA_TYPE_REFERENCE_PARSING_UNSPECIFIED", "DISABLED", "ENABLED", ""}),
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"]`,
},
"disable_referential_integrity": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -258,6 +265,12 @@ func resourceHealthcareFhirStoreCreate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("version"); !tpgresource.IsEmptyValue(reflect.ValueOf(versionProp)) && (ok || !reflect.DeepEqual(v, versionProp)) {
obj["version"] = versionProp
}
complexDataTypeReferenceParsingProp, err := expandHealthcareFhirStoreComplexDataTypeReferenceParsing(d.Get("complex_data_type_reference_parsing"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("complex_data_type_reference_parsing"); !tpgresource.IsEmptyValue(reflect.ValueOf(complexDataTypeReferenceParsingProp)) && (ok || !reflect.DeepEqual(v, complexDataTypeReferenceParsingProp)) {
obj["complexDataTypeReferenceParsing"] = complexDataTypeReferenceParsingProp
}
enableUpdateCreateProp, err := expandHealthcareFhirStoreEnableUpdateCreate(d.Get("enable_update_create"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -387,6 +400,9 @@ func resourceHealthcareFhirStoreRead(d *schema.ResourceData, meta interface{}) e
if err := d.Set("version", flattenHealthcareFhirStoreVersion(res["version"], d, config)); err != nil {
return fmt.Errorf("Error reading FhirStore: %s", err)
}
if err := d.Set("complex_data_type_reference_parsing", flattenHealthcareFhirStoreComplexDataTypeReferenceParsing(res["complexDataTypeReferenceParsing"], d, config)); err != nil {
return fmt.Errorf("Error reading FhirStore: %s", err)
}
if err := d.Set("enable_update_create", flattenHealthcareFhirStoreEnableUpdateCreate(res["enableUpdateCreate"], d, config)); err != nil {
return fmt.Errorf("Error reading FhirStore: %s", err)
}
Expand Down Expand Up @@ -422,6 +438,12 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
billingProject := ""

obj := make(map[string]interface{})
complexDataTypeReferenceParsingProp, err := expandHealthcareFhirStoreComplexDataTypeReferenceParsing(d.Get("complex_data_type_reference_parsing"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("complex_data_type_reference_parsing"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, complexDataTypeReferenceParsingProp)) {
obj["complexDataTypeReferenceParsing"] = complexDataTypeReferenceParsingProp
}
enableUpdateCreateProp, err := expandHealthcareFhirStoreEnableUpdateCreate(d.Get("enable_update_create"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -455,6 +477,10 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
log.Printf("[DEBUG] Updating FhirStore %q: %#v", d.Id(), obj)
updateMask := []string{}

if d.HasChange("complex_data_type_reference_parsing") {
updateMask = append(updateMask, "complexDataTypeReferenceParsing")
}

if d.HasChange("enable_update_create") {
updateMask = append(updateMask, "enableUpdateCreate")
}
Expand Down Expand Up @@ -567,6 +593,10 @@ func flattenHealthcareFhirStoreVersion(v interface{}, d *schema.ResourceData, co
return v
}

func flattenHealthcareFhirStoreComplexDataTypeReferenceParsing(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenHealthcareFhirStoreEnableUpdateCreate(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down Expand Up @@ -690,6 +720,10 @@ func expandHealthcareFhirStoreVersion(v interface{}, d tpgresource.TerraformReso
return v, nil
}

func expandHealthcareFhirStoreComplexDataTypeReferenceParsing(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandHealthcareFhirStoreEnableUpdateCreate(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
Expand Down
6 changes: 6 additions & 0 deletions website/docs/r/healthcare_fhir_store.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "google_healthcare_fhir_store" "default" {
name = "example-fhir-store"
dataset = google_healthcare_dataset.dataset.id
version = "R4"
complex_data_type_reference_parsing = "DISABLED"

enable_update_create = false
disable_referential_integrity = false
Expand Down Expand Up @@ -221,6 +222,11 @@ The following arguments are supported:
Default value is `STU3`.
Possible values are: `DSTU2`, `STU3`, `R4`.

* `complex_data_type_reference_parsing` -
(Optional)
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 are: `COMPLEX_DATA_TYPE_REFERENCE_PARSING_UNSPECIFIED`, `DISABLED`, `ENABLED`.

* `enable_update_create` -
(Optional)
Whether this FHIR store has the updateCreate capability. This determines if the client can use an Update
Expand Down