Skip to content

Commit

Permalink
Promote healthcare resources to GA (GoogleCloudPlatform#3377)
Browse files Browse the repository at this point in the history
* add GA healthcare API

* add ga resources to website

* rename test files

* stop skipping hl7 test

* Removing erb syntax and GA's utils file

* formatting and fixing imports

* move client config to GA and cleanup tests

Co-authored-by: Chris Stephens <chrisst@google.com>
  • Loading branch information
2 people authored and Nathan Klish committed May 18, 2020
1 parent 87c6b1a commit c9774d1
Show file tree
Hide file tree
Showing 18 changed files with 441 additions and 162 deletions.
11 changes: 7 additions & 4 deletions products/healthcare/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
name: Healthcare
display_name: Cloud Healthcare
versions:
- !ruby/object:Api::Product::Version
name: ga
base_url: https://healthcare.googleapis.com/v1/
- !ruby/object:Api::Product::Version
name: beta
base_url: https://healthcare.googleapis.com/v1beta1/
Expand Down Expand Up @@ -73,7 +76,7 @@ objects:
guides:
'Creating a dataset':
'https://cloud.google.com/healthcare/docs/how-tos/datasets'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets'
- !ruby/object:Api::Resource
name: 'DicomStore'
kind: "healthcare#dicomStore"
Expand Down Expand Up @@ -153,7 +156,7 @@ objects:
guides:
'Creating a DICOM store':
'https://cloud.google.com/healthcare/docs/how-tos/dicom'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.dicomStores'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.dicomStores'
- !ruby/object:Api::Resource
name: 'FhirStore'
kind: "healthcare#fhirStore"
Expand Down Expand Up @@ -292,7 +295,7 @@ objects:
guides:
'Creating a FHIR store':
'https://cloud.google.com/healthcare/docs/how-tos/fhir'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.fhirStores'
- !ruby/object:Api::Resource
name: 'Hl7V2Store'
kind: "healthcare#hl7V2Store"
Expand Down Expand Up @@ -404,4 +407,4 @@ objects:
guides:
'Creating a HL7v2 Store':
'https://cloud.google.com/healthcare/docs/how-tos/hl7v2'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.hl7V2Stores'
api: 'https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores'
6 changes: 1 addition & 5 deletions products/healthcare/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "healthcare_dataset_basic"
skip_test: true
primary_resource_id: "default"
vars:
dataset_name: "example-dataset"
Expand All @@ -44,7 +43,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "healthcare_fhir_store_basic"
skip_test: true
primary_resource_id: "default"
vars:
dataset_name: "example-dataset"
Expand All @@ -66,7 +64,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "healthcare_dicom_store_basic"
skip_test: true
primary_resource_id: "default"
vars:
dataset_name: "example-dataset"
Expand All @@ -88,8 +85,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "healthcare_hl7_v2_store_basic"
min_version: beta
primary_resource_id: "store"
primary_resource_id: "default"
vars:
dataset_name: "example-dataset"
hl7_v2_store_name: "example-hl7-v2-store"
Expand Down
421 changes: 421 additions & 0 deletions templates/stackdriver.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ resource "google_healthcare_dataset" "default" {
name = "<%= ctx[:vars]['dataset_name'] %>"
location = "us-central1"
time_zone = "UTC"
provider = google-beta
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ resource "google_healthcare_dicom_store" "default" {
labels = {
label1 = "labelvalue1"
}
provider = google-beta
}

resource "google_pubsub_topic" "topic" {
name = "<%= ctx[:vars]['pubsub_topic']%>"
provider = google-beta
}

resource "google_healthcare_dataset" "dataset" {
name = "<%= ctx[:vars]['dataset_name'] %>"
location = "us-central1"
provider = google-beta
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ resource "google_healthcare_fhir_store" "default" {
labels = {
label1 = "labelvalue1"
}
provider = google-beta
}

resource "google_pubsub_topic" "topic" {
name = "<%= ctx[:vars]['pubsub_topic']%>"
provider = google-beta
}

resource "google_healthcare_dataset" "dataset" {
name = "<%= ctx[:vars]['dataset_name'] %>"
location = "us-central1"
provider = google-beta
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ resource "google_healthcare_hl7_v2_store" "default" {
labels = {
label1 = "labelvalue1"
}

provider = google-beta
}

resource "google_pubsub_topic" "topic" {
name = "<%= ctx[:vars]['pubsub_topic']%>"
provider = google-beta
}

resource "google_healthcare_dataset" "dataset" {
name = "<%= ctx[:vars]['dataset_name'] %>"
location = "us-central1"
provider = google-beta
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"reflect"
Expand Down Expand Up @@ -252,6 +251,3 @@ resource "google_healthcare_dataset_iam_policy" "foo" {
}
`, account, DEFAULT_HEALTHCARE_TEST_LOCATION, datasetName, roleId)
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
Expand Down Expand Up @@ -106,33 +104,6 @@ func TestAccHealthcareDataset_basic(t *testing.T) {
})
}

func testAccCheckHealthcareDatasetDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
if rs.Type != "google_healthcare_dataset" {
continue
}
if strings.HasPrefix(name, "data.") {
continue
}

config := googleProviderConfig(t)

url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}projects/{{project}}/locations/{{location}}/datasets/{{name}}")
if err != nil {
return err
}

_, err = sendRequest(config, "GET", "", url, nil)
if err == nil {
return fmt.Errorf("HealthcareDataset still exists at %s", url)
}
}

return nil
}
}

func testAccCheckGoogleHealthcareDatasetUpdate(t *testing.T, timeZone string) resource.TestCheckFunc {
return func(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
Expand Down Expand Up @@ -179,6 +150,3 @@ resource "google_healthcare_dataset" "dataset" {
}
`, datasetName, location, timeZone)
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"reflect"
Expand Down Expand Up @@ -352,6 +351,3 @@ resource "google_healthcare_dicom_store_iam_policy" "foo" {
}
`, account, datasetName, dicomStoreName, roleId)
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"path"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
Expand Down Expand Up @@ -156,33 +154,6 @@ resource "google_pubsub_topic" "topic" {
`, dicomStoreName, datasetName, pubsubTopic)
}

func testAccCheckHealthcareDicomStoreDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
if rs.Type != "google_healthcare_dicom_store" {
continue
}
if strings.HasPrefix(name, "data.") {
continue
}

config := googleProviderConfig(t)

url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}{{dataset}}/dicomStores/{{name}}")
if err != nil {
return err
}

_, err = sendRequest(config, "GET", "", url, nil)
if err == nil {
return fmt.Errorf("HealthcareDicomStore still exists at %s", url)
}
}

return nil
}
}

func testAccCheckGoogleHealthcareDicomStoreUpdate(t *testing.T, pubsubTopic string) resource.TestCheckFunc {
return func(s *terraform.State) error {
var foundResource = false
Expand Down Expand Up @@ -220,6 +191,3 @@ func testAccCheckGoogleHealthcareDicomStoreUpdate(t *testing.T, pubsubTopic stri
return nil
}
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"reflect"
Expand Down Expand Up @@ -352,6 +351,3 @@ resource "google_healthcare_fhir_store_iam_policy" "foo" {
}
`, account, datasetName, fhirStoreName, roleId)
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"path"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
Expand Down Expand Up @@ -162,33 +160,6 @@ resource "google_pubsub_topic" "topic" {
`, fhirStoreName, datasetName, pubsubTopic)
}

func testAccCheckHealthcareFhirStoreDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
if rs.Type != "google_healthcare_fhir_store" {
continue
}
if strings.HasPrefix(name, "data.") {
continue
}

config := googleProviderConfig(t)

url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}{{dataset}}/fhirStores/{{name}}")
if err != nil {
return err
}

_, err = sendRequest(config, "GET", "", url, nil)
if err == nil {
return fmt.Errorf("HealthcareFhirStore still exists at %s", url)
}
}

return nil
}
}

func testAccCheckGoogleHealthcareFhirStoreUpdate(t *testing.T, pubsubTopic string) resource.TestCheckFunc {
return func(s *terraform.State) error {
var foundResource = false
Expand Down Expand Up @@ -237,6 +208,3 @@ func testAccCheckGoogleHealthcareFhirStoreUpdate(t *testing.T, pubsubTopic strin
return nil
}
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"reflect"
Expand Down Expand Up @@ -352,6 +351,3 @@ resource "google_healthcare_hl7_v2_store_iam_policy" "foo" {
}
`, account, datasetName, hl7V2StoreName, roleId)
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
"path"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
Expand Down Expand Up @@ -209,6 +207,3 @@ func testAccCheckGoogleHealthcareHl7V2StoreUpdate(t *testing.T, pubsubTopic stri
return nil
}
}
<% else %>
// Magic Modules doesn't let us remove files - blank out beta-only common-compile files for now.
<% end -%>
Loading

0 comments on commit c9774d1

Please sign in to comment.