From 5fe049090a0ec02924821d5ae05fec4fb5b47f2e Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Fri, 20 May 2022 14:30:32 +0530 Subject: [PATCH 1/7] Only add Dataplex lake resources --- mmv1/third_party/terraform/go.mod.erb | 2 +- .../third_party/terraform/utils/config.go.erb | 1 + .../terraform/utils/provider.go.erb | 3 ++ tpgtools/api/dataplex/basic.lake.json | 10 +++++++ tpgtools/api/dataplex/basic_lake.yaml | 30 +++++++++++++++++++ tpgtools/api/dataplex/update.lake.json | 10 +++++++ tpgtools/overrides/dataplex/beta/lake.yaml | 0 tpgtools/overrides/dataplex/lake.yaml | 0 tpgtools/overrides/dataplex/lake/meta.yaml | 0 9 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 tpgtools/api/dataplex/basic.lake.json create mode 100755 tpgtools/api/dataplex/basic_lake.yaml create mode 100755 tpgtools/api/dataplex/update.lake.json create mode 100644 tpgtools/overrides/dataplex/beta/lake.yaml create mode 100644 tpgtools/overrides/dataplex/lake.yaml create mode 100644 tpgtools/overrides/dataplex/lake/meta.yaml diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index 12ba6f079d9f..cf3c45c46c04 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -4,7 +4,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve require ( cloud.google.com/go/bigtable v1.13.0 cloud.google.com/go/iam v0.1.1 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/mmv1/third_party/terraform/utils/config.go.erb b/mmv1/third_party/terraform/utils/config.go.erb index a2af85f9e063..4890c2ca179c 100644 --- a/mmv1/third_party/terraform/utils/config.go.erb +++ b/mmv1/third_party/terraform/utils/config.go.erb @@ -210,6 +210,7 @@ type Config struct { CloudResourceManagerBasePath string ContainerAwsBasePath string ContainerAzureBasePath string + DataplexBasePath string EventarcBasePath string FirebaserulesBasePath string GkeHubBasePath string diff --git a/mmv1/third_party/terraform/utils/provider.go.erb b/mmv1/third_party/terraform/utils/provider.go.erb index 235a6be224fe..2eac0dd97bd9 100644 --- a/mmv1/third_party/terraform/utils/provider.go.erb +++ b/mmv1/third_party/terraform/utils/provider.go.erb @@ -181,6 +181,7 @@ func Provider() *schema.Provider { AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry, ClouddeployEndpointEntryKey: ClouddeployEndpointEntry, CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry, + DataplexEndpointEntryKey: DataplexEndpointEntry, EventarcEndpointEntryKey: EventarcEndpointEntry, FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry, GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry, @@ -492,6 +493,7 @@ end # products.each do "google_container_azure_client": resourceContainerAzureClient(), "google_container_azure_cluster": resourceContainerAzureCluster(), "google_container_azure_node_pool": resourceContainerAzureNodePool(), + "google_dataplex_lake": resourceDataplexLake(), "google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(), "google_eventarc_trigger": resourceEventarcTrigger(), "google_firebaserules_release": resourceFirebaserulesRelease(), @@ -694,6 +696,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string) config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string) config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string) + config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string) config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string) config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string) config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string) diff --git a/tpgtools/api/dataplex/basic.lake.json b/tpgtools/api/dataplex/basic.lake.json new file mode 100755 index 000000000000..94b2fb80aa52 --- /dev/null +++ b/tpgtools/api/dataplex/basic.lake.json @@ -0,0 +1,10 @@ +{ + "name": "{{lake_name}}", + "displayName": "Lake for DCL", + "location": "{{region}}", + "project": "{{project}}", + "labels": { + "my-lake": "exists" + }, + "description": "Lake for DCL" +} diff --git a/tpgtools/api/dataplex/basic_lake.yaml b/tpgtools/api/dataplex/basic_lake.yaml new file mode 100755 index 000000000000..4b6cbf76d1af --- /dev/null +++ b/tpgtools/api/dataplex/basic_lake.yaml @@ -0,0 +1,30 @@ +# Copyright 2022 Google LLC. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: basic_lake +description: A basic example of a dataplex lake +type: lake +versions: +- ga +- v1 +resource: samples/basic.lake.json +updates: +- resource: samples/update.lake.json + dependencies: [] +variables: +- name: lake_name + type: resource_name +- name: project + type: project +- name: region + type: region diff --git a/tpgtools/api/dataplex/update.lake.json b/tpgtools/api/dataplex/update.lake.json new file mode 100755 index 000000000000..fa606a565e05 --- /dev/null +++ b/tpgtools/api/dataplex/update.lake.json @@ -0,0 +1,10 @@ +{ + "name": "{{lake_name}}", + "displayName": "Lake for DCL", + "location": "{{region}}", + "project": "{{project}}", + "labels": { + "my-lake": "exists" + }, + "description": "Updated description for lake" +} diff --git a/tpgtools/overrides/dataplex/beta/lake.yaml b/tpgtools/overrides/dataplex/beta/lake.yaml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tpgtools/overrides/dataplex/lake.yaml b/tpgtools/overrides/dataplex/lake.yaml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tpgtools/overrides/dataplex/lake/meta.yaml b/tpgtools/overrides/dataplex/lake/meta.yaml new file mode 100644 index 000000000000..e69de29bb2d1 From 474d9fa360271a3fb792b5932806d30f55a23bba Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Fri, 20 May 2022 09:03:15 +0000 Subject: [PATCH 2/7] run make serialize --- mmv1/third_party/terraform/go.sum | 2 + tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 +- tpgtools/serialization.go | 292 ++++++++++++++++++++++++++++++ 4 files changed, 297 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index c449eef40c71..d2599659c6ba 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1598,3 +1598,5 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 8b2f84eb5e0e..216f1127ed7b 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index 98a9d22e94fd..cb0325793cc9 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2 h1:SrHcyR/zNEaghHyLZvKKIjKL6RKNuESkyYZIgMHE3ko= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= diff --git a/tpgtools/serialization.go b/tpgtools/serialization.go index ed8df073a133..7deef03aead5 100644 --- a/tpgtools/serialization.go +++ b/tpgtools/serialization.go @@ -39,6 +39,8 @@ import ( containerawsBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws/beta" containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure" containerazureBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure/beta" + dataplex "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataplex" + dataplexBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataplex/beta" dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc" dataprocBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc/beta" eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc" @@ -107,6 +109,8 @@ func DCLToTerraformReference(product DCLPackageName, resource miscellaneousNameS return "google_container_azure_cluster", nil case "containerazure/node_pool": return "google_container_azure_node_pool", nil + case "dataplex/lake": + return "google_dataplex_lake", nil case "dataproc/workflow_template": return "google_dataproc_workflow_template", nil case "eventarc/trigger": @@ -175,6 +179,8 @@ func DCLToTerraformReference(product DCLPackageName, resource miscellaneousNameS return "google_container_azure_cluster", nil case "containerazure/node_pool": return "google_container_azure_node_pool", nil + case "dataplex/lake": + return "google_dataplex_lake", nil case "dataproc/workflow_template": return "google_dataproc_workflow_template", nil case "eventarc/trigger": @@ -319,6 +325,12 @@ func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSn return "", err } return ContainerAzureNodePoolBetaAsHCL(*r, hasGAEquivalent) + case "dataplex/lake": + r := &dataplexBeta.Lake{} + if err := json.Unmarshal(b, r); err != nil { + return "", err + } + return DataplexLakeBetaAsHCL(*r, hasGAEquivalent) case "dataproc/workflow_template": r := &dataprocBeta.WorkflowTemplate{} if err := json.Unmarshal(b, r); err != nil { @@ -515,6 +527,12 @@ func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSn return "", err } return ContainerAzureNodePoolAsHCL(*r, hasGAEquivalent) + case "dataplex/lake": + r := &dataplex.Lake{} + if err := json.Unmarshal(b, r); err != nil { + return "", err + } + return DataplexLakeAsHCL(*r, hasGAEquivalent) case "dataproc/workflow_template": r := &dataproc.WorkflowTemplate{} if err := json.Unmarshal(b, r); err != nil { @@ -2511,6 +2529,75 @@ func convertContainerAzureNodePoolBetaMaxPodsConstraintToHCL(r *containerazureBe return outputConfig + "}" } +// DataplexLakeBetaAsHCL returns a string representation of the specified resource in HCL. +// The generated HCL will include every settable field as a literal - that is, no +// variables, no references. This may not be the best possible representation, but +// the crucial point is that `terraform import; terraform apply` will not produce +// any changes. We do not validate that the resource specified will pass terraform +// validation unless is an object returned from the API after an Apply. +func DataplexLakeBetaAsHCL(r dataplexBeta.Lake, hasGAEquivalent bool) (string, error) { + outputConfig := "resource \"google_dataplex_lake\" \"output\" {\n" + if r.Location != nil { + outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) + } + if r.Name != nil { + outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) + } + if r.Description != nil { + outputConfig += fmt.Sprintf("\tdescription = %#v\n", *r.Description) + } + if r.DisplayName != nil { + outputConfig += fmt.Sprintf("\tdisplay_name = %#v\n", *r.DisplayName) + } + outputConfig += "\tlabels = {" + for k, v := range r.Labels { + outputConfig += fmt.Sprintf("%v = %q, ", k, v) + } + outputConfig += "}\n" + if v := convertDataplexLakeBetaMetastoreToHCL(r.Metastore); v != "" { + outputConfig += fmt.Sprintf("\tmetastore %s\n", v) + } + if r.Project != nil { + outputConfig += fmt.Sprintf("\tproject = %#v\n", *r.Project) + } + formatted, err := formatHCL(outputConfig + "}") + if err != nil { + return "", err + } + if !hasGAEquivalent { + // The formatter will not accept the google-beta symbol because it is injected during testing. + return withProviderLine(formatted), nil + } + return formatted, nil +} + +func convertDataplexLakeBetaMetastoreToHCL(r *dataplexBeta.LakeMetastore) string { + if r == nil { + return "" + } + outputConfig := "{\n" + if r.Service != nil { + outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service) + } + return outputConfig + "}" +} + +func convertDataplexLakeBetaAssetStatusToHCL(r *dataplexBeta.LakeAssetStatus) string { + if r == nil { + return "" + } + outputConfig := "{\n" + return outputConfig + "}" +} + +func convertDataplexLakeBetaMetastoreStatusToHCL(r *dataplexBeta.LakeMetastoreStatus) string { + if r == nil { + return "" + } + outputConfig := "{\n" + return outputConfig + "}" +} + // DataprocWorkflowTemplateBetaAsHCL returns a string representation of the specified resource in HCL. // The generated HCL will include every settable field as a literal - that is, no // variables, no references. This may not be the best possible representation, but @@ -7672,6 +7759,75 @@ func convertContainerAzureNodePoolMaxPodsConstraintToHCL(r *containerazure.NodeP return outputConfig + "}" } +// DataplexLakeAsHCL returns a string representation of the specified resource in HCL. +// The generated HCL will include every settable field as a literal - that is, no +// variables, no references. This may not be the best possible representation, but +// the crucial point is that `terraform import; terraform apply` will not produce +// any changes. We do not validate that the resource specified will pass terraform +// validation unless is an object returned from the API after an Apply. +func DataplexLakeAsHCL(r dataplex.Lake, hasGAEquivalent bool) (string, error) { + outputConfig := "resource \"google_dataplex_lake\" \"output\" {\n" + if r.Location != nil { + outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) + } + if r.Name != nil { + outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) + } + if r.Description != nil { + outputConfig += fmt.Sprintf("\tdescription = %#v\n", *r.Description) + } + if r.DisplayName != nil { + outputConfig += fmt.Sprintf("\tdisplay_name = %#v\n", *r.DisplayName) + } + outputConfig += "\tlabels = {" + for k, v := range r.Labels { + outputConfig += fmt.Sprintf("%v = %q, ", k, v) + } + outputConfig += "}\n" + if v := convertDataplexLakeMetastoreToHCL(r.Metastore); v != "" { + outputConfig += fmt.Sprintf("\tmetastore %s\n", v) + } + if r.Project != nil { + outputConfig += fmt.Sprintf("\tproject = %#v\n", *r.Project) + } + formatted, err := formatHCL(outputConfig + "}") + if err != nil { + return "", err + } + if !hasGAEquivalent { + // The formatter will not accept the google-beta symbol because it is injected during testing. + return withProviderLine(formatted), nil + } + return formatted, nil +} + +func convertDataplexLakeMetastoreToHCL(r *dataplex.LakeMetastore) string { + if r == nil { + return "" + } + outputConfig := "{\n" + if r.Service != nil { + outputConfig += fmt.Sprintf("\tservice = %#v\n", *r.Service) + } + return outputConfig + "}" +} + +func convertDataplexLakeAssetStatusToHCL(r *dataplex.LakeAssetStatus) string { + if r == nil { + return "" + } + outputConfig := "{\n" + return outputConfig + "}" +} + +func convertDataplexLakeMetastoreStatusToHCL(r *dataplex.LakeMetastoreStatus) string { + if r == nil { + return "" + } + outputConfig := "{\n" + return outputConfig + "}" +} + // DataprocWorkflowTemplateAsHCL returns a string representation of the specified resource in HCL. // The generated HCL will include every settable field as a literal - that is, no // variables, no references. This may not be the best possible representation, but @@ -12254,6 +12410,74 @@ func convertContainerAzureNodePoolBetaMaxPodsConstraintList(i interface{}) (out return out } +func convertDataplexLakeBetaMetastore(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "service": in["service"], + } +} + +func convertDataplexLakeBetaMetastoreList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeBetaMetastore(v)) + } + return out +} + +func convertDataplexLakeBetaAssetStatus(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "activeAssets": in["active_assets"], + "securityPolicyApplyingAssets": in["security_policy_applying_assets"], + "updateTime": in["update_time"], + } +} + +func convertDataplexLakeBetaAssetStatusList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeBetaAssetStatus(v)) + } + return out +} + +func convertDataplexLakeBetaMetastoreStatus(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "endpoint": in["endpoint"], + "message": in["message"], + "state": in["state"], + "updateTime": in["update_time"], + } +} + +func convertDataplexLakeBetaMetastoreStatusList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeBetaMetastoreStatus(v)) + } + return out +} + func convertDataprocWorkflowTemplateBetaJobs(i interface{}) map[string]interface{} { if i == nil { return nil @@ -17085,6 +17309,74 @@ func convertContainerAzureNodePoolMaxPodsConstraintList(i interface{}) (out []ma return out } +func convertDataplexLakeMetastore(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "service": in["service"], + } +} + +func convertDataplexLakeMetastoreList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeMetastore(v)) + } + return out +} + +func convertDataplexLakeAssetStatus(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "activeAssets": in["active_assets"], + "securityPolicyApplyingAssets": in["security_policy_applying_assets"], + "updateTime": in["update_time"], + } +} + +func convertDataplexLakeAssetStatusList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeAssetStatus(v)) + } + return out +} + +func convertDataplexLakeMetastoreStatus(i interface{}) map[string]interface{} { + if i == nil { + return nil + } + in := i.(map[string]interface{}) + return map[string]interface{}{ + "endpoint": in["endpoint"], + "message": in["message"], + "state": in["state"], + "updateTime": in["update_time"], + } +} + +func convertDataplexLakeMetastoreStatusList(i interface{}) (out []map[string]interface{}) { + if i == nil { + return nil + } + + for _, v := range i.([]interface{}) { + out = append(out, convertDataplexLakeMetastoreStatus(v)) + } + return out +} + func convertDataprocWorkflowTemplateJobs(i interface{}) map[string]interface{} { if i == nil { return nil From d13fdee11d3765a7ac62289178c716f6abdd02c1 Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Fri, 20 May 2022 18:49:46 +0000 Subject: [PATCH 3/7] Moved samples to the correct location --- mmv1/third_party/terraform/go.sum | 2 ++ tpgtools/api/dataplex/{ => samples}/basic.lake.json | 0 tpgtools/api/dataplex/{ => samples}/basic_lake.yaml | 0 tpgtools/api/dataplex/{ => samples}/update.lake.json | 0 tpgtools/overrides/dataplex/{ => samples}/lake/meta.yaml | 0 5 files changed, 2 insertions(+) rename tpgtools/api/dataplex/{ => samples}/basic.lake.json (100%) rename tpgtools/api/dataplex/{ => samples}/basic_lake.yaml (100%) rename tpgtools/api/dataplex/{ => samples}/update.lake.json (100%) rename tpgtools/overrides/dataplex/{ => samples}/lake/meta.yaml (100%) diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index d2599659c6ba..dcae9ed42e8a 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1600,3 +1600,5 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/api/dataplex/basic.lake.json b/tpgtools/api/dataplex/samples/basic.lake.json similarity index 100% rename from tpgtools/api/dataplex/basic.lake.json rename to tpgtools/api/dataplex/samples/basic.lake.json diff --git a/tpgtools/api/dataplex/basic_lake.yaml b/tpgtools/api/dataplex/samples/basic_lake.yaml similarity index 100% rename from tpgtools/api/dataplex/basic_lake.yaml rename to tpgtools/api/dataplex/samples/basic_lake.yaml diff --git a/tpgtools/api/dataplex/update.lake.json b/tpgtools/api/dataplex/samples/update.lake.json similarity index 100% rename from tpgtools/api/dataplex/update.lake.json rename to tpgtools/api/dataplex/samples/update.lake.json diff --git a/tpgtools/overrides/dataplex/lake/meta.yaml b/tpgtools/overrides/dataplex/samples/lake/meta.yaml similarity index 100% rename from tpgtools/overrides/dataplex/lake/meta.yaml rename to tpgtools/overrides/dataplex/samples/lake/meta.yaml From 3f561fc52ae631beaec46e280a4d3e32cd48ed85 Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Fri, 20 May 2022 20:04:09 +0000 Subject: [PATCH 4/7] Use lake instead of lake_name as variable placeholder --- mmv1/third_party/terraform/go.sum | 2 ++ tpgtools/api/dataplex/samples/basic.lake.json | 2 +- tpgtools/api/dataplex/samples/basic_lake.yaml | 2 +- tpgtools/api/dataplex/samples/update.lake.json | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index dcae9ed42e8a..1d496f5fd830 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1602,3 +1602,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeT github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/api/dataplex/samples/basic.lake.json b/tpgtools/api/dataplex/samples/basic.lake.json index 94b2fb80aa52..8c2c56b7b3e2 100755 --- a/tpgtools/api/dataplex/samples/basic.lake.json +++ b/tpgtools/api/dataplex/samples/basic.lake.json @@ -1,5 +1,5 @@ { - "name": "{{lake_name}}", + "name": "{{lake}}", "displayName": "Lake for DCL", "location": "{{region}}", "project": "{{project}}", diff --git a/tpgtools/api/dataplex/samples/basic_lake.yaml b/tpgtools/api/dataplex/samples/basic_lake.yaml index 4b6cbf76d1af..d2c53b43b00e 100755 --- a/tpgtools/api/dataplex/samples/basic_lake.yaml +++ b/tpgtools/api/dataplex/samples/basic_lake.yaml @@ -22,7 +22,7 @@ updates: - resource: samples/update.lake.json dependencies: [] variables: -- name: lake_name +- name: lake type: resource_name - name: project type: project diff --git a/tpgtools/api/dataplex/samples/update.lake.json b/tpgtools/api/dataplex/samples/update.lake.json index fa606a565e05..1b2418256784 100755 --- a/tpgtools/api/dataplex/samples/update.lake.json +++ b/tpgtools/api/dataplex/samples/update.lake.json @@ -1,5 +1,5 @@ { - "name": "{{lake_name}}", + "name": "{{lake}}", "displayName": "Lake for DCL", "location": "{{region}}", "project": "{{project}}", From 52621585181bdf4a2bd0bec829a9a107ea69e3a4 Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Mon, 23 May 2022 17:46:31 +0000 Subject: [PATCH 5/7] migrate to DCL version 1.8 --- mmv1/third_party/terraform/go.mod.erb | 2 +- mmv1/third_party/terraform/go.sum | 2 ++ tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index cf3c45c46c04..6e1b5f9ad2db 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -4,7 +4,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve require ( cloud.google.com/go/bigtable v1.13.0 cloud.google.com/go/iam v0.1.1 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 1d496f5fd830..90ac44263a90 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1604,3 +1604,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeT github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 216f1127ed7b..a1c413b45767 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index cb0325793cc9..8a3e86db8c7b 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= From 97bcdaee898bc057c9fbeada4b6fc144e2ac4f93 Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Mon, 23 May 2022 20:39:04 +0000 Subject: [PATCH 6/7] Updated DCL to 1.8.1 --- mmv1/third_party/terraform/go.mod.erb | 2 +- mmv1/third_party/terraform/go.sum | 2 + tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 +- tpgtools/serialization.go | 76 +++++++++++++-------------- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index 6e1b5f9ad2db..040ab3a7dbe2 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -4,7 +4,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve require ( cloud.google.com/go/bigtable v1.13.0 cloud.google.com/go/iam v0.1.1 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 90ac44263a90..13613957b21e 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1606,3 +1606,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeT github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/go.mod b/tpgtools/go.mod index a1c413b45767..bf0f5b17fc45 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index 8a3e86db8c7b..2c5c83319982 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= diff --git a/tpgtools/serialization.go b/tpgtools/serialization.go index 7deef03aead5..7aa5c72bcfea 100644 --- a/tpgtools/serialization.go +++ b/tpgtools/serialization.go @@ -3862,14 +3862,14 @@ func EventarcTriggerBetaAsHCL(r eventarcBeta.Trigger, hasGAEquivalent bool) (str if v := convertEventarcTriggerBetaDestinationToHCL(r.Destination); v != "" { outputConfig += fmt.Sprintf("\tdestination %s\n", v) } + if r.EventFilters != nil { + for _, v := range r.EventFilters { + outputConfig += fmt.Sprintf("\tevent_filters %s\n", convertEventarcTriggerBetaEventFiltersToHCL(&v)) + } + } if r.Location != nil { outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) } - if r.MatchingCriteria != nil { - for _, v := range r.MatchingCriteria { - outputConfig += fmt.Sprintf("\tmatching_criteria %s\n", convertEventarcTriggerBetaMatchingCriteriaToHCL(&v)) - } - } if r.Name != nil { outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) } @@ -3906,8 +3906,8 @@ func convertEventarcTriggerBetaDestinationToHCL(r *eventarcBeta.TriggerDestinati if r.CloudFunction != nil { outputConfig += fmt.Sprintf("\tcloud_function = %#v\n", *r.CloudFunction) } - if v := convertEventarcTriggerBetaDestinationCloudRunServiceToHCL(r.CloudRunService); v != "" { - outputConfig += fmt.Sprintf("\tcloud_run_service %s\n", v) + if v := convertEventarcTriggerBetaDestinationCloudRunToHCL(r.CloudRun); v != "" { + outputConfig += fmt.Sprintf("\tcloud_run %s\n", v) } if v := convertEventarcTriggerBetaDestinationGkeToHCL(r.Gke); v != "" { outputConfig += fmt.Sprintf("\tgke %s\n", v) @@ -3918,7 +3918,7 @@ func convertEventarcTriggerBetaDestinationToHCL(r *eventarcBeta.TriggerDestinati return outputConfig + "}" } -func convertEventarcTriggerBetaDestinationCloudRunServiceToHCL(r *eventarcBeta.TriggerDestinationCloudRunService) string { +func convertEventarcTriggerBetaDestinationCloudRunToHCL(r *eventarcBeta.TriggerDestinationCloudRun) string { if r == nil { return "" } @@ -3958,7 +3958,7 @@ func convertEventarcTriggerBetaDestinationGkeToHCL(r *eventarcBeta.TriggerDestin return outputConfig + "}" } -func convertEventarcTriggerBetaMatchingCriteriaToHCL(r *eventarcBeta.TriggerMatchingCriteria) string { +func convertEventarcTriggerBetaEventFiltersToHCL(r *eventarcBeta.TriggerEventFilters) string { if r == nil { return "" } @@ -9050,14 +9050,14 @@ func EventarcTriggerAsHCL(r eventarc.Trigger, hasGAEquivalent bool) (string, err if v := convertEventarcTriggerDestinationToHCL(r.Destination); v != "" { outputConfig += fmt.Sprintf("\tdestination %s\n", v) } + if r.EventFilters != nil { + for _, v := range r.EventFilters { + outputConfig += fmt.Sprintf("\tevent_filters %s\n", convertEventarcTriggerEventFiltersToHCL(&v)) + } + } if r.Location != nil { outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) } - if r.MatchingCriteria != nil { - for _, v := range r.MatchingCriteria { - outputConfig += fmt.Sprintf("\tmatching_criteria %s\n", convertEventarcTriggerMatchingCriteriaToHCL(&v)) - } - } if r.Name != nil { outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) } @@ -9094,8 +9094,8 @@ func convertEventarcTriggerDestinationToHCL(r *eventarc.TriggerDestination) stri if r.CloudFunction != nil { outputConfig += fmt.Sprintf("\tcloud_function = %#v\n", *r.CloudFunction) } - if v := convertEventarcTriggerDestinationCloudRunServiceToHCL(r.CloudRunService); v != "" { - outputConfig += fmt.Sprintf("\tcloud_run_service %s\n", v) + if v := convertEventarcTriggerDestinationCloudRunToHCL(r.CloudRun); v != "" { + outputConfig += fmt.Sprintf("\tcloud_run %s\n", v) } if v := convertEventarcTriggerDestinationGkeToHCL(r.Gke); v != "" { outputConfig += fmt.Sprintf("\tgke %s\n", v) @@ -9106,7 +9106,7 @@ func convertEventarcTriggerDestinationToHCL(r *eventarc.TriggerDestination) stri return outputConfig + "}" } -func convertEventarcTriggerDestinationCloudRunServiceToHCL(r *eventarc.TriggerDestinationCloudRunService) string { +func convertEventarcTriggerDestinationCloudRunToHCL(r *eventarc.TriggerDestinationCloudRun) string { if r == nil { return "" } @@ -9146,7 +9146,7 @@ func convertEventarcTriggerDestinationGkeToHCL(r *eventarc.TriggerDestinationGke return outputConfig + "}" } -func convertEventarcTriggerMatchingCriteriaToHCL(r *eventarc.TriggerMatchingCriteria) string { +func convertEventarcTriggerEventFiltersToHCL(r *eventarc.TriggerEventFilters) string { if r == nil { return "" } @@ -13794,10 +13794,10 @@ func convertEventarcTriggerBetaDestination(i interface{}) map[string]interface{} } in := i.(map[string]interface{}) return map[string]interface{}{ - "cloudFunction": in["cloud_function"], - "cloudRunService": convertEventarcTriggerBetaDestinationCloudRunService(in["cloud_run_service"]), - "gke": convertEventarcTriggerBetaDestinationGke(in["gke"]), - "workflow": in["workflow"], + "cloudFunction": in["cloud_function"], + "cloudRun": convertEventarcTriggerBetaDestinationCloudRun(in["cloud_run"]), + "gke": convertEventarcTriggerBetaDestinationGke(in["gke"]), + "workflow": in["workflow"], } } @@ -13812,7 +13812,7 @@ func convertEventarcTriggerBetaDestinationList(i interface{}) (out []map[string] return out } -func convertEventarcTriggerBetaDestinationCloudRunService(i interface{}) map[string]interface{} { +func convertEventarcTriggerBetaDestinationCloudRun(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -13824,13 +13824,13 @@ func convertEventarcTriggerBetaDestinationCloudRunService(i interface{}) map[str } } -func convertEventarcTriggerBetaDestinationCloudRunServiceList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerBetaDestinationCloudRunList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerBetaDestinationCloudRunService(v)) + out = append(out, convertEventarcTriggerBetaDestinationCloudRun(v)) } return out } @@ -13860,7 +13860,7 @@ func convertEventarcTriggerBetaDestinationGkeList(i interface{}) (out []map[stri return out } -func convertEventarcTriggerBetaMatchingCriteria(i interface{}) map[string]interface{} { +func convertEventarcTriggerBetaEventFilters(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -13872,13 +13872,13 @@ func convertEventarcTriggerBetaMatchingCriteria(i interface{}) map[string]interf } } -func convertEventarcTriggerBetaMatchingCriteriaList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerBetaEventFiltersList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerBetaMatchingCriteria(v)) + out = append(out, convertEventarcTriggerBetaEventFilters(v)) } return out } @@ -18627,10 +18627,10 @@ func convertEventarcTriggerDestination(i interface{}) map[string]interface{} { } in := i.(map[string]interface{}) return map[string]interface{}{ - "cloudFunction": in["cloud_function"], - "cloudRunService": convertEventarcTriggerDestinationCloudRunService(in["cloud_run_service"]), - "gke": convertEventarcTriggerDestinationGke(in["gke"]), - "workflow": in["workflow"], + "cloudFunction": in["cloud_function"], + "cloudRun": convertEventarcTriggerDestinationCloudRun(in["cloud_run"]), + "gke": convertEventarcTriggerDestinationGke(in["gke"]), + "workflow": in["workflow"], } } @@ -18645,7 +18645,7 @@ func convertEventarcTriggerDestinationList(i interface{}) (out []map[string]inte return out } -func convertEventarcTriggerDestinationCloudRunService(i interface{}) map[string]interface{} { +func convertEventarcTriggerDestinationCloudRun(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -18657,13 +18657,13 @@ func convertEventarcTriggerDestinationCloudRunService(i interface{}) map[string] } } -func convertEventarcTriggerDestinationCloudRunServiceList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerDestinationCloudRunList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerDestinationCloudRunService(v)) + out = append(out, convertEventarcTriggerDestinationCloudRun(v)) } return out } @@ -18693,7 +18693,7 @@ func convertEventarcTriggerDestinationGkeList(i interface{}) (out []map[string]i return out } -func convertEventarcTriggerMatchingCriteria(i interface{}) map[string]interface{} { +func convertEventarcTriggerEventFilters(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -18705,13 +18705,13 @@ func convertEventarcTriggerMatchingCriteria(i interface{}) map[string]interface{ } } -func convertEventarcTriggerMatchingCriteriaList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerEventFiltersList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerMatchingCriteria(v)) + out = append(out, convertEventarcTriggerEventFilters(v)) } return out } From e73d8295ee0385a7f5d081073a626f9e4a79b4d8 Mon Sep 17 00:00:00 2001 From: Saurabh Maurya Date: Tue, 24 May 2022 03:50:29 +0000 Subject: [PATCH 7/7] Updated DCL to 1.8.2 --- mmv1/third_party/terraform/go.mod.erb | 2 +- mmv1/third_party/terraform/go.sum | 2 + tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 +- tpgtools/serialization.go | 76 +++++++++++++-------------- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index 040ab3a7dbe2..5a3542dcdd70 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -4,7 +4,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve require ( cloud.google.com/go/bigtable v1.13.0 cloud.google.com/go/iam v0.1.1 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 13613957b21e..7f48b46e7340 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1608,3 +1608,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztg github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 h1:V2EzqYSMPUkyKTtSevKTFU0Dw7nK6uVpg40U31Y0x/8= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= diff --git a/tpgtools/go.mod b/tpgtools/go.mod index bf0f5b17fc45..f9cdd068ae69 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index 2c5c83319982..0c19a8d0d670 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 h1:V2EzqYSMPUkyKTtSevKTFU0Dw7nK6uVpg40U31Y0x/8= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= diff --git a/tpgtools/serialization.go b/tpgtools/serialization.go index 7aa5c72bcfea..7deef03aead5 100644 --- a/tpgtools/serialization.go +++ b/tpgtools/serialization.go @@ -3862,14 +3862,14 @@ func EventarcTriggerBetaAsHCL(r eventarcBeta.Trigger, hasGAEquivalent bool) (str if v := convertEventarcTriggerBetaDestinationToHCL(r.Destination); v != "" { outputConfig += fmt.Sprintf("\tdestination %s\n", v) } - if r.EventFilters != nil { - for _, v := range r.EventFilters { - outputConfig += fmt.Sprintf("\tevent_filters %s\n", convertEventarcTriggerBetaEventFiltersToHCL(&v)) - } - } if r.Location != nil { outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) } + if r.MatchingCriteria != nil { + for _, v := range r.MatchingCriteria { + outputConfig += fmt.Sprintf("\tmatching_criteria %s\n", convertEventarcTriggerBetaMatchingCriteriaToHCL(&v)) + } + } if r.Name != nil { outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) } @@ -3906,8 +3906,8 @@ func convertEventarcTriggerBetaDestinationToHCL(r *eventarcBeta.TriggerDestinati if r.CloudFunction != nil { outputConfig += fmt.Sprintf("\tcloud_function = %#v\n", *r.CloudFunction) } - if v := convertEventarcTriggerBetaDestinationCloudRunToHCL(r.CloudRun); v != "" { - outputConfig += fmt.Sprintf("\tcloud_run %s\n", v) + if v := convertEventarcTriggerBetaDestinationCloudRunServiceToHCL(r.CloudRunService); v != "" { + outputConfig += fmt.Sprintf("\tcloud_run_service %s\n", v) } if v := convertEventarcTriggerBetaDestinationGkeToHCL(r.Gke); v != "" { outputConfig += fmt.Sprintf("\tgke %s\n", v) @@ -3918,7 +3918,7 @@ func convertEventarcTriggerBetaDestinationToHCL(r *eventarcBeta.TriggerDestinati return outputConfig + "}" } -func convertEventarcTriggerBetaDestinationCloudRunToHCL(r *eventarcBeta.TriggerDestinationCloudRun) string { +func convertEventarcTriggerBetaDestinationCloudRunServiceToHCL(r *eventarcBeta.TriggerDestinationCloudRunService) string { if r == nil { return "" } @@ -3958,7 +3958,7 @@ func convertEventarcTriggerBetaDestinationGkeToHCL(r *eventarcBeta.TriggerDestin return outputConfig + "}" } -func convertEventarcTriggerBetaEventFiltersToHCL(r *eventarcBeta.TriggerEventFilters) string { +func convertEventarcTriggerBetaMatchingCriteriaToHCL(r *eventarcBeta.TriggerMatchingCriteria) string { if r == nil { return "" } @@ -9050,14 +9050,14 @@ func EventarcTriggerAsHCL(r eventarc.Trigger, hasGAEquivalent bool) (string, err if v := convertEventarcTriggerDestinationToHCL(r.Destination); v != "" { outputConfig += fmt.Sprintf("\tdestination %s\n", v) } - if r.EventFilters != nil { - for _, v := range r.EventFilters { - outputConfig += fmt.Sprintf("\tevent_filters %s\n", convertEventarcTriggerEventFiltersToHCL(&v)) - } - } if r.Location != nil { outputConfig += fmt.Sprintf("\tlocation = %#v\n", *r.Location) } + if r.MatchingCriteria != nil { + for _, v := range r.MatchingCriteria { + outputConfig += fmt.Sprintf("\tmatching_criteria %s\n", convertEventarcTriggerMatchingCriteriaToHCL(&v)) + } + } if r.Name != nil { outputConfig += fmt.Sprintf("\tname = %#v\n", *r.Name) } @@ -9094,8 +9094,8 @@ func convertEventarcTriggerDestinationToHCL(r *eventarc.TriggerDestination) stri if r.CloudFunction != nil { outputConfig += fmt.Sprintf("\tcloud_function = %#v\n", *r.CloudFunction) } - if v := convertEventarcTriggerDestinationCloudRunToHCL(r.CloudRun); v != "" { - outputConfig += fmt.Sprintf("\tcloud_run %s\n", v) + if v := convertEventarcTriggerDestinationCloudRunServiceToHCL(r.CloudRunService); v != "" { + outputConfig += fmt.Sprintf("\tcloud_run_service %s\n", v) } if v := convertEventarcTriggerDestinationGkeToHCL(r.Gke); v != "" { outputConfig += fmt.Sprintf("\tgke %s\n", v) @@ -9106,7 +9106,7 @@ func convertEventarcTriggerDestinationToHCL(r *eventarc.TriggerDestination) stri return outputConfig + "}" } -func convertEventarcTriggerDestinationCloudRunToHCL(r *eventarc.TriggerDestinationCloudRun) string { +func convertEventarcTriggerDestinationCloudRunServiceToHCL(r *eventarc.TriggerDestinationCloudRunService) string { if r == nil { return "" } @@ -9146,7 +9146,7 @@ func convertEventarcTriggerDestinationGkeToHCL(r *eventarc.TriggerDestinationGke return outputConfig + "}" } -func convertEventarcTriggerEventFiltersToHCL(r *eventarc.TriggerEventFilters) string { +func convertEventarcTriggerMatchingCriteriaToHCL(r *eventarc.TriggerMatchingCriteria) string { if r == nil { return "" } @@ -13794,10 +13794,10 @@ func convertEventarcTriggerBetaDestination(i interface{}) map[string]interface{} } in := i.(map[string]interface{}) return map[string]interface{}{ - "cloudFunction": in["cloud_function"], - "cloudRun": convertEventarcTriggerBetaDestinationCloudRun(in["cloud_run"]), - "gke": convertEventarcTriggerBetaDestinationGke(in["gke"]), - "workflow": in["workflow"], + "cloudFunction": in["cloud_function"], + "cloudRunService": convertEventarcTriggerBetaDestinationCloudRunService(in["cloud_run_service"]), + "gke": convertEventarcTriggerBetaDestinationGke(in["gke"]), + "workflow": in["workflow"], } } @@ -13812,7 +13812,7 @@ func convertEventarcTriggerBetaDestinationList(i interface{}) (out []map[string] return out } -func convertEventarcTriggerBetaDestinationCloudRun(i interface{}) map[string]interface{} { +func convertEventarcTriggerBetaDestinationCloudRunService(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -13824,13 +13824,13 @@ func convertEventarcTriggerBetaDestinationCloudRun(i interface{}) map[string]int } } -func convertEventarcTriggerBetaDestinationCloudRunList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerBetaDestinationCloudRunServiceList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerBetaDestinationCloudRun(v)) + out = append(out, convertEventarcTriggerBetaDestinationCloudRunService(v)) } return out } @@ -13860,7 +13860,7 @@ func convertEventarcTriggerBetaDestinationGkeList(i interface{}) (out []map[stri return out } -func convertEventarcTriggerBetaEventFilters(i interface{}) map[string]interface{} { +func convertEventarcTriggerBetaMatchingCriteria(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -13872,13 +13872,13 @@ func convertEventarcTriggerBetaEventFilters(i interface{}) map[string]interface{ } } -func convertEventarcTriggerBetaEventFiltersList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerBetaMatchingCriteriaList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerBetaEventFilters(v)) + out = append(out, convertEventarcTriggerBetaMatchingCriteria(v)) } return out } @@ -18627,10 +18627,10 @@ func convertEventarcTriggerDestination(i interface{}) map[string]interface{} { } in := i.(map[string]interface{}) return map[string]interface{}{ - "cloudFunction": in["cloud_function"], - "cloudRun": convertEventarcTriggerDestinationCloudRun(in["cloud_run"]), - "gke": convertEventarcTriggerDestinationGke(in["gke"]), - "workflow": in["workflow"], + "cloudFunction": in["cloud_function"], + "cloudRunService": convertEventarcTriggerDestinationCloudRunService(in["cloud_run_service"]), + "gke": convertEventarcTriggerDestinationGke(in["gke"]), + "workflow": in["workflow"], } } @@ -18645,7 +18645,7 @@ func convertEventarcTriggerDestinationList(i interface{}) (out []map[string]inte return out } -func convertEventarcTriggerDestinationCloudRun(i interface{}) map[string]interface{} { +func convertEventarcTriggerDestinationCloudRunService(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -18657,13 +18657,13 @@ func convertEventarcTriggerDestinationCloudRun(i interface{}) map[string]interfa } } -func convertEventarcTriggerDestinationCloudRunList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerDestinationCloudRunServiceList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerDestinationCloudRun(v)) + out = append(out, convertEventarcTriggerDestinationCloudRunService(v)) } return out } @@ -18693,7 +18693,7 @@ func convertEventarcTriggerDestinationGkeList(i interface{}) (out []map[string]i return out } -func convertEventarcTriggerEventFilters(i interface{}) map[string]interface{} { +func convertEventarcTriggerMatchingCriteria(i interface{}) map[string]interface{} { if i == nil { return nil } @@ -18705,13 +18705,13 @@ func convertEventarcTriggerEventFilters(i interface{}) map[string]interface{} { } } -func convertEventarcTriggerEventFiltersList(i interface{}) (out []map[string]interface{}) { +func convertEventarcTriggerMatchingCriteriaList(i interface{}) (out []map[string]interface{}) { if i == nil { return nil } for _, v := range i.([]interface{}) { - out = append(out, convertEventarcTriggerEventFilters(v)) + out = append(out, convertEventarcTriggerMatchingCriteria(v)) } return out }