Skip to content

Commit a8d5fd7

Browse files
authored
Added consentConfig to healthcare FHIR store. (#15039)
1 parent fd2ed72 commit a8d5fd7

File tree

3 files changed

+154
-0
lines changed

3 files changed

+154
-0
lines changed

mmv1/products/healthcare/FhirStore.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ examples:
6969
dataset_name: 'example-dataset'
7070
fhir_store_name: 'example-fhir-store'
7171
pubsub_topic: 'fhir-notifications'
72+
- name: 'healthcare_fhir_store_consent_config'
73+
primary_resource_id: 'default'
74+
min_version: "beta"
75+
vars:
76+
dataset_name: 'example-dataset'
77+
fhir_store_name: 'example-fhir-store'
78+
pubsub_topic: 'fhir-notifications'
7279
parameters:
7380
- name: 'dataset'
7481
type: ResourceRef
@@ -113,6 +120,60 @@ properties:
113120
- 'DSTU2'
114121
- 'STU3'
115122
- 'R4'
123+
- name: 'consentConfig'
124+
type: NestedObject
125+
description: |
126+
Specifies whether this store has consent enforcement. Not available for DSTU2 FHIR version due to absence of Consent resources. Not supported for R5 FHIR version.
127+
min_version: beta
128+
properties:
129+
- name: 'version'
130+
type: Enum
131+
description: |
132+
Specifies which consent enforcement version is being used for this FHIR store. This field can only be set once by either [fhirStores.create][] or [fhirStores.patch][]. After that, you must call [fhirStores.applyConsents][] to change the version.
133+
required: true
134+
enum_values:
135+
- 'CONSENT_ENFORCEMENT_VERSION_UNSPECIFIED'
136+
- 'V1'
137+
- name: 'accessEnforced'
138+
type: Boolean
139+
description: |
140+
The default value is false. If set to true, when accessing FHIR resources, the consent headers will be verified against consents given by patients. See the ConsentEnforcementVersion for the supported consent headers.
141+
- name: 'consentHeaderHandling'
142+
type: NestedObject
143+
description: |
144+
Different options to configure the behaviour of the server when handling the X-Consent-Scope header.
145+
properties:
146+
- name: 'profile'
147+
type: Enum
148+
description: |
149+
Specifies the default server behavior when the header is empty. If not specified, the ScopeProfile.PERMIT_EMPTY_SCOPE option is used.
150+
enum_values:
151+
- 'SCOPE_PROFILE_UNSPECIFIED'
152+
- 'PERMIT_EMPTY_SCOPE'
153+
- 'REQUIRED_ON_READ'
154+
default_value: "PERMIT_EMPTY_SCOPE"
155+
- name: 'accessDeterminationLogConfig'
156+
type: NestedObject
157+
description: |
158+
Specifies how the server logs the consent-aware requests. If not specified, the AccessDeterminationLogConfig.LogLevel.MINIMUM option is used.
159+
properties:
160+
- name: 'logLevel'
161+
type: Enum
162+
description: |
163+
Controls the amount of detail to include as part of the audit logs.
164+
enum_values:
165+
- 'LOG_LEVEL_UNSPECIFIED'
166+
- 'DISABLED'
167+
- 'MINIMUM'
168+
- 'VERBOSE'
169+
default_value: "MINIMUM"
170+
- name: 'enforcedAdminConsents'
171+
type: Array
172+
description: |
173+
The versioned names of the enforced admin Consent resource(s), in the format projects/{projectId}/locations/{location}/datasets/{datasetId}/fhirStores/{fhirStoreId}/fhir/Consent/{resourceId}/_history/{version_id}. For FHIR stores with disableResourceVersioning=true, the format is projects/{projectId}/locations/{location}/datasets/{datasetId}/fhirStores/{fhirStoreId}/fhir/Consent/{resourceId}. This field can only be updated using [fhirStores.applyAdminConsents][].
174+
output: true
175+
item_type:
176+
type: String
116177
- name: 'complexDataTypeReferenceParsing'
117178
type: Enum
118179
description: |
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
resource "google_healthcare_fhir_store" "default" {
2+
name = "{{index $.Vars "fhir_store_name"}}"
3+
dataset = google_healthcare_dataset.dataset.id
4+
version = "R4"
5+
complex_data_type_reference_parsing = "DISABLED"
6+
7+
enable_update_create = false
8+
disable_referential_integrity = false
9+
disable_resource_versioning = false
10+
enable_history_import = false
11+
default_search_handling_strict = false
12+
13+
notification_configs {
14+
pubsub_topic = google_pubsub_topic.topic.id
15+
}
16+
17+
labels = {
18+
label1 = "labelvalue1"
19+
}
20+
21+
consent_config {
22+
version = "V1"
23+
access_enforced = true
24+
consent_header_handling {
25+
profile = "REQUIRED_ON_READ"
26+
}
27+
access_determination_log_config {
28+
log_level = "VERBOSE"
29+
}
30+
}
31+
32+
provider = google-beta
33+
}
34+
35+
resource "google_pubsub_topic" "topic" {
36+
name = "{{index $.Vars "pubsub_topic"}}"
37+
38+
provider = google-beta
39+
}
40+
41+
resource "google_healthcare_dataset" "dataset" {
42+
name = "{{index $.Vars "dataset_name"}}"
43+
location = "us-central1"
44+
45+
provider = google-beta
46+
}

mmv1/third_party/terraform/services/healthcare/resource_healthcare_fhir_store_test.go.tmpl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ resource "google_healthcare_fhir_store" "default" {
135135
{{- if ne $.TargetVersionName "ga" }}
136136
enable_history_modifications = false
137137
{{- end }}
138+
139+
{{- if ne $.TargetVersionName "ga" }}
140+
consent_config {
141+
version = "V1"
142+
access_enforced = false
143+
consent_header_handling {
144+
profile = "PERMIT_EMPTY_SCOPE"
145+
}
146+
access_determination_log_config {
147+
log_level = "DISABLED"
148+
}
149+
}
150+
{{- end }}
138151
}
139152
140153
resource "google_healthcare_dataset" "dataset" {
@@ -163,6 +176,19 @@ resource "google_healthcare_fhir_store" "default" {
163176
enable_history_modifications = true
164177
{{- end }}
165178
179+
{{- if ne $.TargetVersionName "ga" }}
180+
consent_config {
181+
version = "V1"
182+
access_enforced = true
183+
consent_header_handling {
184+
profile = "REQUIRED_ON_READ"
185+
}
186+
access_determination_log_config {
187+
log_level = "VERBOSE"
188+
}
189+
}
190+
{{- end }}
191+
166192
labels = {
167193
label1 = "labelvalue1"
168194
}
@@ -200,6 +226,27 @@ func testAccCheckGoogleHealthcareFhirStoreUpdate(t *testing.T, pubsubTopic strin
200226
return fmt.Errorf("Unexpected failure while verifying 'updated' dataset: %s", err)
201227
}
202228

229+
{{- if ne $.TargetVersionName "ga" }}
230+
if response.ConsentConfig == nil {
231+
return fmt.Errorf("fhirStore 'ConsentConfig' missing: %s", gcpResourceUri)
232+
}
233+
if !response.ConsentConfig.AccessEnforced {
234+
return fmt.Errorf("fhirStore 'ConsentConfig.AccessEnforced' not updated: %s", gcpResourceUri)
235+
}
236+
if response.ConsentConfig.ConsentHeaderHandling == nil {
237+
return fmt.Errorf("fhirStore 'ConsentConfig.ConsentHeaderHandling' missing: %s", gcpResourceUri)
238+
}
239+
if response.ConsentConfig.ConsentHeaderHandling.Profile != "REQUIRED_ON_READ" {
240+
return fmt.Errorf("fhirStore 'ConsentConfig.ConsentHeaderHandling.Profile' not updated: %s", gcpResourceUri)
241+
}
242+
if response.ConsentConfig.AccessDeterminationLogConfig == nil {
243+
return fmt.Errorf("fhirStore 'ConsentConfig.AccessDeterminationLogConfig' missing: %s", gcpResourceUri)
244+
}
245+
if response.ConsentConfig.AccessDeterminationLogConfig.LogLevel != "VERBOSE" {
246+
return fmt.Errorf("fhirStore 'ConsentConfig.AccessDeterminationLogConfig.LogLevel' not updated: %s", gcpResourceUri)
247+
}
248+
{{- end }}
249+
203250
if !response.EnableUpdateCreate {
204251
return fmt.Errorf("fhirStore 'EnableUpdateCreate' not updated: %s", gcpResourceUri)
205252
}

0 commit comments

Comments
 (0)