Skip to content

Commit

Permalink
Add notification_config.send_for_bulk_import field to google_healthca…
Browse files Browse the repository at this point in the history
…re_dicom_store (#10855) (#18320)

[upstream:c85842ff834e4f0e19a29038aa1baea8fcb393d1]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jun 4, 2024
1 parent 28bc76c commit 1d1e329
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
22 changes: 22 additions & 0 deletions google/services/healthcare/resource_healthcare_dicom_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ was published. Notifications are only sent if the topic is non-empty. Topic name
project. service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com must have publisher permissions on the given
Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that send notifications to fail.`,
},
"send_for_bulk_import": {
Type: schema.TypeBool,
Optional: true,
Description: `Indicates whether or not to send Pub/Sub notifications on bulk import. Only supported for DICOM imports.`,
},
},
},
},
Expand Down Expand Up @@ -430,12 +435,18 @@ func flattenHealthcareDicomStoreNotificationConfig(v interface{}, d *schema.Reso
transformed := make(map[string]interface{})
transformed["pubsub_topic"] =
flattenHealthcareDicomStoreNotificationConfigPubsubTopic(original["pubsubTopic"], d, config)
transformed["send_for_bulk_import"] =
flattenHealthcareDicomStoreNotificationConfigSendForBulkImport(original["sendForBulkImport"], d, config)
return []interface{}{transformed}
}
func flattenHealthcareDicomStoreNotificationConfigPubsubTopic(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

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

func flattenHealthcareDicomStoreTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
Expand Down Expand Up @@ -475,13 +486,24 @@ func expandHealthcareDicomStoreNotificationConfig(v interface{}, d tpgresource.T
transformed["pubsubTopic"] = transformedPubsubTopic
}

transformedSendForBulkImport, err := expandHealthcareDicomStoreNotificationConfigSendForBulkImport(original["send_for_bulk_import"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSendForBulkImport); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["sendForBulkImport"] = transformedSendForBulkImport
}

return transformed, nil
}

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

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

func expandHealthcareDicomStoreEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ resource "google_healthcare_dicom_store" "default" {
dataset = google_healthcare_dataset.dataset.id
notification_config {
pubsub_topic = google_pubsub_topic.topic.id
pubsub_topic = google_pubsub_topic.topic.id
send_for_bulk_import = true
}
labels = {
Expand Down Expand Up @@ -192,6 +193,10 @@ func testAccCheckGoogleHealthcareDicomStoreUpdate(t *testing.T, pubsubTopic stri
if topicName != pubsubTopic {
return fmt.Errorf("dicomStore 'NotificationConfig' not updated ('%s' != '%s'): %s", topicName, pubsubTopic, gcpResourceUri)
}

if !response.NotificationConfig.SendForBulkImport {
return fmt.Errorf("dicomStore 'NotificationConfig.SendForBulkImport' not changed to true: %s", gcpResourceUri)
}
}

if !foundResource {
Expand Down
7 changes: 6 additions & 1 deletion website/docs/r/healthcare_dicom_store.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ resource "google_healthcare_dicom_store" "default" {
dataset = google_healthcare_dataset.dataset.id
notification_config {
pubsub_topic = google_pubsub_topic.topic.id
pubsub_topic = google_pubsub_topic.topic.id
send_for_bulk_import = true
}
labels = {
Expand Down Expand Up @@ -179,6 +180,10 @@ The following arguments are supported:
project. service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com must have publisher permissions on the given
Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that send notifications to fail.

* `send_for_bulk_import` -
(Optional)
Indicates whether or not to send Pub/Sub notifications on bulk import. Only supported for DICOM imports.

<a name="nested_stream_configs"></a>The `stream_configs` block supports:

* `bigquery_destination` -
Expand Down

0 comments on commit 1d1e329

Please sign in to comment.