Skip to content

Commit

Permalink
Promote google_datafusion_instance to GA (#5683) (#11087)
Browse files Browse the repository at this point in the history
Co-authored-by: upodroid <cy@borg.dev>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: upodroid <cy@borg.dev>
  • Loading branch information
modular-magician and upodroid committed Feb 11, 2022
1 parent e702784 commit 1fe3655
Show file tree
Hide file tree
Showing 8 changed files with 1,122 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .changelog/5683.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```release-note:enhancement
datafusion: promoted `google_datafusion_instance` to GA
```
```release-note:deprecation
datafusion: deprecated `service_account` in `google_datafusion_instance`. Use `tenant_project_id` instead to extract the tenant project ID (beta)
```
```release-note:enhancement
datafusion: added support for `tenant_project_id` and `gcs_bucket` in `google_datafusion_instance` resource.
```
4 changes: 4 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type Config struct {
ComputeBasePath string
ContainerAnalysisBasePath string
DataCatalogBasePath string
DataFusionBasePath string
DataLossPreventionBasePath string
DataprocBasePath string
DatastoreBasePath string
Expand Down Expand Up @@ -278,6 +279,7 @@ const CloudTasksBasePathKey = "CloudTasks"
const ComputeBasePathKey = "Compute"
const ContainerAnalysisBasePathKey = "ContainerAnalysis"
const DataCatalogBasePathKey = "DataCatalog"
const DataFusionBasePathKey = "DataFusion"
const DataLossPreventionBasePathKey = "DataLossPrevention"
const DataprocBasePathKey = "Dataproc"
const DatastoreBasePathKey = "Datastore"
Expand Down Expand Up @@ -359,6 +361,7 @@ var DefaultBasePaths = map[string]string{
ComputeBasePathKey: "https://compute.googleapis.com/compute/v1/",
ContainerAnalysisBasePathKey: "https://containeranalysis.googleapis.com/v1/",
DataCatalogBasePathKey: "https://datacatalog.googleapis.com/v1/",
DataFusionBasePathKey: "https://datafusion.googleapis.com/v1/",
DataLossPreventionBasePathKey: "https://dlp.googleapis.com/v2/",
DataprocBasePathKey: "https://dataproc.googleapis.com/v1/",
DatastoreBasePathKey: "https://datastore.googleapis.com/v1/",
Expand Down Expand Up @@ -1202,6 +1205,7 @@ func ConfigureBasePaths(c *Config) {
c.ComputeBasePath = DefaultBasePaths[ComputeBasePathKey]
c.ContainerAnalysisBasePath = DefaultBasePaths[ContainerAnalysisBasePathKey]
c.DataCatalogBasePath = DefaultBasePaths[DataCatalogBasePathKey]
c.DataFusionBasePath = DefaultBasePaths[DataFusionBasePathKey]
c.DataLossPreventionBasePath = DefaultBasePaths[DataLossPreventionBasePathKey]
c.DataprocBasePath = DefaultBasePaths[DataprocBasePathKey]
c.DatastoreBasePath = DefaultBasePaths[DatastoreBasePathKey]
Expand Down
74 changes: 74 additions & 0 deletions google/data_fusion_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package google

import (
"encoding/json"
"fmt"
"time"
)

type DataFusionOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *DataFusionOperationWaiter) QueryOp() (interface{}, error) {
if w == nil {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
// Returns the proper get.
url := fmt.Sprintf("%s%s", w.Config.DataFusionBasePath, w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}

func createDataFusionWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*DataFusionOperationWaiter, error) {
w := &DataFusionOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func dataFusionOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createDataFusionWaiter(config, op, project, activity, userAgent)
if err != nil {
return err
}
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func dataFusionOperationWaitTime(config *Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createDataFusionWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
14 changes: 12 additions & 2 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ func Provider() *schema.Provider {
"GOOGLE_DATA_CATALOG_CUSTOM_ENDPOINT"<