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 authored 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",
}, DefaultBasePaths[DataCatalogBasePathKey]),
},
"data_fusion_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_DATA_FUSION_CUSTOM_ENDPOINT",
}, DefaultBasePaths[DataFusionBasePathKey]),
},
"data_loss_prevention_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -813,9 +821,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 215
// Generated resources: 216
// Generated IAM resources: 96
// Total generated resources: 311
// Total generated resources: 312
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -979,6 +987,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_data_catalog_tag_template_iam_member": ResourceIamMember(DataCatalogTagTemplateIamSchema, DataCatalogTagTemplateIamUpdaterProducer, DataCatalogTagTemplateIdParseFunc),
"google_data_catalog_tag_template_iam_policy": ResourceIamPolicy(DataCatalogTagTemplateIamSchema, DataCatalogTagTemplateIamUpdaterProducer, DataCatalogTagTemplateIdParseFunc),
"google_data_catalog_tag": resourceDataCatalogTag(),
"google_data_fusion_instance": resourceDataFusionInstance(),
"google_data_loss_prevention_job_trigger": resourceDataLossPreventionJobTrigger(),
"google_data_loss_prevention_inspect_template": resourceDataLossPreventionInspectTemplate(),
"google_data_loss_prevention_stored_info_type": resourceDataLossPreventionStoredInfoType(),
Expand Down Expand Up @@ -1397,6 +1406,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.ComputeBasePath = d.Get("compute_custom_endpoint").(string)
config.ContainerAnalysisBasePath = d.Get("container_analysis_custom_endpoint").(string)
config.DataCatalogBasePath = d.Get("data_catalog_custom_endpoint").(string)
config.DataFusionBasePath = d.Get("data_fusion_custom_endpoint").(string)
config.DataLossPreventionBasePath = d.Get("data_loss_prevention_custom_endpoint").(string)
config.DataprocBasePath = d.Get("dataproc_custom_endpoint").(string)
config.DatastoreBasePath = d.Get("datastore_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 1fe3655

Please sign in to comment.