@@ -163,6 +163,7 @@ Please refer to the field 'effective_labels' for all of the labels present on th
163
163
"notification_config" : {
164
164
Type : schema .TypeList ,
165
165
Optional : true ,
166
+ Deprecated : "`notification_config` is deprecated and will be removed in a future major release. Use `notification_configs` instead." ,
166
167
Description : `A nested object resource` ,
167
168
MaxItems : 1 ,
168
169
Elem : & schema.Resource {
@@ -180,6 +181,43 @@ Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that s
180
181
},
181
182
},
182
183
},
184
+ "notification_configs" : {
185
+ Type : schema .TypeList ,
186
+ Optional : true ,
187
+ Description : `A list of notifcation configs that configure the notification for every resource mutation in this FHIR store.` ,
188
+ Elem : & schema.Resource {
189
+ Schema : map [string ]* schema.Schema {
190
+ "pubsub_topic" : {
191
+ Type : schema .TypeString ,
192
+ Required : true ,
193
+ Description : `The Cloud Pub/Sub topic that notifications of changes are published on. Supplied by the client.
194
+ PubsubMessage.Data will contain the resource name. PubsubMessage.MessageId is the ID of this message.
195
+ It is guaranteed to be unique within the topic. PubsubMessage.PublishTime is the time at which the message
196
+ was published. Notifications are only sent if the topic is non-empty. Topic names must be scoped to a
197
+ project. [email protected] must have publisher permissions on the given
198
+ Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that send notifications to fail.` ,
199
+ },
200
+ "send_full_resource" : {
201
+ Type : schema .TypeBool ,
202
+ Optional : true ,
203
+ Description : `Whether to send full FHIR resource to this Pub/Sub topic for Create and Update operation.
204
+ Note that setting this to true does not guarantee that all resources will be sent in the format of
205
+ full FHIR resource. When a resource change is too large or during heavy traffic, only the resource name will be
206
+ sent. Clients should always check the "payloadType" label from a Pub/Sub message to determine whether
207
+ it needs to fetch the full resource as a separate operation.` ,
208
+ },
209
+ "send_previous_resource_on_delete" : {
210
+ Type : schema .TypeBool ,
211
+ Optional : true ,
212
+ Description : `Whether to send full FHIR resource to this Pub/Sub topic for deleting FHIR resource. Note that setting this to
213
+ true does not guarantee that all previous resources will be sent in the format of full FHIR resource. When a
214
+ resource change is too large or during heavy traffic, only the resource name will be sent. Clients should always
215
+ check the "payloadType" label from a Pub/Sub message to determine whether it needs to fetch the full previous
216
+ resource as a separate operation.` ,
217
+ },
218
+ },
219
+ },
220
+ },
183
221
"stream_configs" : {
184
222
Type : schema .TypeList ,
185
223
Optional : true ,
@@ -364,6 +402,12 @@ func resourceHealthcareFhirStoreCreate(d *schema.ResourceData, meta interface{})
364
402
} else if v , ok := d .GetOkExists ("default_search_handling_strict" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (defaultSearchHandlingStrictProp )) && (ok || ! reflect .DeepEqual (v , defaultSearchHandlingStrictProp )) {
365
403
obj ["defaultSearchHandlingStrict" ] = defaultSearchHandlingStrictProp
366
404
}
405
+ notificationConfigsProp , err := expandHealthcareFhirStoreNotificationConfigs (d .Get ("notification_configs" ), d , config )
406
+ if err != nil {
407
+ return err
408
+ } else if v , ok := d .GetOkExists ("notification_configs" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (notificationConfigsProp )) && (ok || ! reflect .DeepEqual (v , notificationConfigsProp )) {
409
+ obj ["notificationConfigs" ] = notificationConfigsProp
410
+ }
367
411
labelsProp , err := expandHealthcareFhirStoreEffectiveLabels (d .Get ("effective_labels" ), d , config )
368
412
if err != nil {
369
413
return err
@@ -488,6 +532,9 @@ func resourceHealthcareFhirStoreRead(d *schema.ResourceData, meta interface{}) e
488
532
if err := d .Set ("default_search_handling_strict" , flattenHealthcareFhirStoreDefaultSearchHandlingStrict (res ["defaultSearchHandlingStrict" ], d , config )); err != nil {
489
533
return fmt .Errorf ("Error reading FhirStore: %s" , err )
490
534
}
535
+ if err := d .Set ("notification_configs" , flattenHealthcareFhirStoreNotificationConfigs (res ["notificationConfigs" ], d , config )); err != nil {
536
+ return fmt .Errorf ("Error reading FhirStore: %s" , err )
537
+ }
491
538
if err := d .Set ("terraform_labels" , flattenHealthcareFhirStoreTerraformLabels (res ["labels" ], d , config )); err != nil {
492
539
return fmt .Errorf ("Error reading FhirStore: %s" , err )
493
540
}
@@ -538,6 +585,12 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
538
585
} else if v , ok := d .GetOkExists ("default_search_handling_strict" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , defaultSearchHandlingStrictProp )) {
539
586
obj ["defaultSearchHandlingStrict" ] = defaultSearchHandlingStrictProp
540
587
}
588
+ notificationConfigsProp , err := expandHealthcareFhirStoreNotificationConfigs (d .Get ("notification_configs" ), d , config )
589
+ if err != nil {
590
+ return err
591
+ } else if v , ok := d .GetOkExists ("notification_configs" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , notificationConfigsProp )) {
592
+ obj ["notificationConfigs" ] = notificationConfigsProp
593
+ }
541
594
labelsProp , err := expandHealthcareFhirStoreEffectiveLabels (d .Get ("effective_labels" ), d , config )
542
595
if err != nil {
543
596
return err
@@ -574,6 +627,10 @@ func resourceHealthcareFhirStoreUpdate(d *schema.ResourceData, meta interface{})
574
627
updateMask = append (updateMask , "defaultSearchHandlingStrict" )
575
628
}
576
629
630
+ if d .HasChange ("notification_configs" ) {
631
+ updateMask = append (updateMask , "notificationConfigs" )
632
+ }
633
+
577
634
if d .HasChange ("effective_labels" ) {
578
635
updateMask = append (updateMask , "labels" )
579
636
}
@@ -841,6 +898,38 @@ func flattenHealthcareFhirStoreDefaultSearchHandlingStrict(v interface{}, d *sch
841
898
return v
842
899
}
843
900
901
+ func flattenHealthcareFhirStoreNotificationConfigs (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
902
+ if v == nil {
903
+ return v
904
+ }
905
+ l := v .([]interface {})
906
+ transformed := make ([]interface {}, 0 , len (l ))
907
+ for _ , raw := range l {
908
+ original := raw .(map [string ]interface {})
909
+ if len (original ) < 1 {
910
+ // Do not include empty json objects coming back from the api
911
+ continue
912
+ }
913
+ transformed = append (transformed , map [string ]interface {}{
914
+ "pubsub_topic" : flattenHealthcareFhirStoreNotificationConfigsPubsubTopic (original ["pubsubTopic" ], d , config ),
915
+ "send_full_resource" : flattenHealthcareFhirStoreNotificationConfigsSendFullResource (original ["sendFullResource" ], d , config ),
916
+ "send_previous_resource_on_delete" : flattenHealthcareFhirStoreNotificationConfigsSendPreviousResourceOnDelete (original ["sendPreviousResourceOnDelete" ], d , config ),
917
+ })
918
+ }
919
+ return transformed
920
+ }
921
+ func flattenHealthcareFhirStoreNotificationConfigsPubsubTopic (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
922
+ return v
923
+ }
924
+
925
+ func flattenHealthcareFhirStoreNotificationConfigsSendFullResource (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
926
+ return v
927
+ }
928
+
929
+ func flattenHealthcareFhirStoreNotificationConfigsSendPreviousResourceOnDelete (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
930
+ return v
931
+ }
932
+
844
933
func flattenHealthcareFhirStoreTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
845
934
if v == nil {
846
935
return v
@@ -1053,6 +1142,54 @@ func expandHealthcareFhirStoreDefaultSearchHandlingStrict(v interface{}, d tpgre
1053
1142
return v , nil
1054
1143
}
1055
1144
1145
+ func expandHealthcareFhirStoreNotificationConfigs (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1146
+ l := v .([]interface {})
1147
+ req := make ([]interface {}, 0 , len (l ))
1148
+ for _ , raw := range l {
1149
+ if raw == nil {
1150
+ continue
1151
+ }
1152
+ original := raw .(map [string ]interface {})
1153
+ transformed := make (map [string ]interface {})
1154
+
1155
+ transformedPubsubTopic , err := expandHealthcareFhirStoreNotificationConfigsPubsubTopic (original ["pubsub_topic" ], d , config )
1156
+ if err != nil {
1157
+ return nil , err
1158
+ } else if val := reflect .ValueOf (transformedPubsubTopic ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1159
+ transformed ["pubsubTopic" ] = transformedPubsubTopic
1160
+ }
1161
+
1162
+ transformedSendFullResource , err := expandHealthcareFhirStoreNotificationConfigsSendFullResource (original ["send_full_resource" ], d , config )
1163
+ if err != nil {
1164
+ return nil , err
1165
+ } else if val := reflect .ValueOf (transformedSendFullResource ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1166
+ transformed ["sendFullResource" ] = transformedSendFullResource
1167
+ }
1168
+
1169
+ transformedSendPreviousResourceOnDelete , err := expandHealthcareFhirStoreNotificationConfigsSendPreviousResourceOnDelete (original ["send_previous_resource_on_delete" ], d , config )
1170
+ if err != nil {
1171
+ return nil , err
1172
+ } else if val := reflect .ValueOf (transformedSendPreviousResourceOnDelete ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1173
+ transformed ["sendPreviousResourceOnDelete" ] = transformedSendPreviousResourceOnDelete
1174
+ }
1175
+
1176
+ req = append (req , transformed )
1177
+ }
1178
+ return req , nil
1179
+ }
1180
+
1181
+ func expandHealthcareFhirStoreNotificationConfigsPubsubTopic (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1182
+ return v , nil
1183
+ }
1184
+
1185
+ func expandHealthcareFhirStoreNotificationConfigsSendFullResource (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1186
+ return v , nil
1187
+ }
1188
+
1189
+ func expandHealthcareFhirStoreNotificationConfigsSendPreviousResourceOnDelete (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1190
+ return v , nil
1191
+ }
1192
+
1056
1193
func expandHealthcareFhirStoreEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
1057
1194
if v == nil {
1058
1195
return map [string ]string {}, nil
0 commit comments