Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ mmv1:
bundle exec compiler.rb -e terraform -o $(OUTPUT_PATH) -v beta --no-code $(mmv1_compile); \
else \
bundle exec compiler.rb -e terraform -o $(OUTPUT_PATH) -v $(VERSION) $(mmv1_compile); \
go run . --version $(VERSION) --output $(OUTPUT_PATH); \
fi

tpgtools:
Expand Down
24 changes: 20 additions & 4 deletions mmv1/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package api

import (
"fmt"
"maps"
"regexp"
"strings"

Expand Down Expand Up @@ -1279,15 +1280,30 @@ func CompareByName(a, b *Type) int {
return strings.Compare(a.Name, b.Name)
}

func (r Resource) GetPropertyUpdateMasksGroups() map[string][]string {
func (r Resource) GetPropertyUpdateMasksGroupKeys(properties []*Type) []string {
keys := []string{}
for _, prop := range properties {
if prop.FlattenObject {
k := r.GetPropertyUpdateMasksGroupKeys(prop.Properties)
keys = append(keys, k...)
} else if len(prop.UpdateMaskFields) > 0 {
keys = append(keys, google.Underscore(prop.Name))
} else {
keys = append(keys, google.Underscore(prop.Name))
}
}
return keys
}

func (r Resource) GetPropertyUpdateMasksGroups(properties []*Type, maskPrefix string) map[string][]string {
maskGroups := map[string][]string{}
for _, prop := range r.AllUserProperties() {
for _, prop := range properties {
if prop.FlattenObject {
prop.GetNestedPropertyUpdateMasksGroups(maskGroups, prop.ApiName)
maps.Copy(maskGroups, r.GetPropertyUpdateMasksGroups(prop.Properties, prop.ApiName))
} else if len(prop.UpdateMaskFields) > 0 {
maskGroups[google.Underscore(prop.Name)] = prop.UpdateMaskFields
} else {
maskGroups[google.Underscore(prop.Name)] = []string{prop.ApiName}
maskGroups[google.Underscore(prop.Name)] = []string{maskPrefix + prop.ApiName}
}
}
return maskGroups
Expand Down
14 changes: 0 additions & 14 deletions mmv1/api/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -1292,20 +1292,6 @@ func (t Type) NamespaceProperty() string {
//
// end

// new utility function for recursive calls to GetPropertyUpdateMasksGroups

func (t Type) GetNestedPropertyUpdateMasksGroups(maskGroups map[string][]string, maskPrefix string) {
for _, prop := range t.AllProperties() {
if prop.FlattenObject {
prop.GetNestedPropertyUpdateMasksGroups(maskGroups, prop.ApiName)
} else if len(prop.UpdateMaskFields) > 0 {
maskGroups[google.Underscore(prop.Name)] = prop.UpdateMaskFields
} else {
maskGroups[google.Underscore(prop.Name)] = []string{maskPrefix + prop.ApiName}
}
}
}

func (t Type) CustomTemplate(templatePath string, appendNewline bool) string {
return resource.ExecuteTemplate(&t, templatePath, appendNewline)
}
Expand Down
3 changes: 3 additions & 0 deletions mmv1/products/datafusion/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a deprecated file, please edit the go_ version in the same
# directory

--- !ruby/object:Api::Resource
name: 'Instance'
base_url: 'projects/{{project}}/locations/{{region}}/instances'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a temporary file, and should not be edited directly
---
name: 'Instance'
description: |
Expand Down Expand Up @@ -90,7 +89,8 @@ examples:
parameters:
- name: 'region'
type: String
description: "The region of the Data Fusion instance."
description: |
The region of the Data Fusion instance.
url_param_only: true
required: false
immutable: true
Expand All @@ -99,14 +99,16 @@ parameters:
properties:
- name: 'name'
type: String
description: "The ID of the instance or a fully qualified identifier for the instance."
description: |
The ID of the instance or a fully qualified identifier for the instance.
required: true
immutable: true
custom_flatten: 'templates/terraform/custom_flatten/go/name_from_self_link.tmpl'
custom_expand: 'templates/terraform/custom_expand/go/shortname_to_url.go.tmpl'
- name: 'description'
type: String
description: "An optional description of the instance."
description: |
An optional description of the instance.
immutable: true
- name: 'type'
type: Enum
Expand All @@ -129,13 +131,16 @@ properties:
- 'DEVELOPER'
- name: 'enableStackdriverLogging'
type: Boolean
description: "Option to enable Stackdriver Logging."
description: |
Option to enable Stackdriver Logging.
- name: 'enableStackdriverMonitoring'
type: Boolean
description: "Option to enable Stackdriver Monitoring."
description: |
Option to enable Stackdriver Monitoring.
- name: 'enableRbac'
type: Boolean
description: "Option to enable granular role-based access control."
description: |
Option to enable granular role-based access control.
- name: 'labels'
type: KeyValueLabels
description: |
Expand All @@ -144,7 +149,8 @@ properties:
immutable: false
- name: 'options'
type: KeyValuePairs
description: "Map of additional options used to configure the behavior of Data Fusion instance."
description: |
Map of additional options used to configure the behavior of Data Fusion instance.
immutable: true
default_from_api: true
diff_suppress_func: 'instanceOptionsDiffSuppress'
Expand Down Expand Up @@ -178,19 +184,23 @@ properties:
- 'RESTARTING'
- name: 'stateMessage'
type: String
description: "Additional information about the current state of this Data Fusion instance if available."
description: |
Additional information about the current state of this Data Fusion instance if available.
output: true
- name: 'serviceEndpoint'
type: String
description: "Endpoint on which the Data Fusion UI and REST APIs are accessible."
description: |
Endpoint on which the Data Fusion UI and REST APIs are accessible.
output: true
- name: 'version'
type: String
description: "Current version of the Data Fusion."
description: |
Current version of the Data Fusion.
default_from_api: true
- name: 'serviceAccount'
type: String
description: "Service account which will be used to access resources in the customer project."
description: |
Service account which will be used to access resources in the customer project.
min_version: 'beta'
output: true
deprecation_message: '`service_account` is deprecated and will be removed in a future major release. Instead, use `tenant_project_id` to extract the tenant project ID.'
Expand All @@ -203,19 +213,23 @@ properties:
immutable: true
- name: 'dataprocServiceAccount'
type: String
description: "User-managed service account to set on Dataproc when Cloud Data Fusion creates Dataproc to run data processing pipelines."
description: |
User-managed service account to set on Dataproc when Cloud Data Fusion creates Dataproc to run data processing pipelines.
immutable: true
- name: 'tenantProjectId'
type: String
description: "The name of the tenant project."
description: |
The name of the tenant project.
output: true
- name: 'gcsBucket'
type: String
description: "Cloud Storage bucket generated by Data Fusion in the customer project."
description: |
Cloud Storage bucket generated by Data Fusion in the customer project.
output: true
- name: 'networkConfig'
type: NestedObject
description: "Network configuration options. These are required when a private Data Fusion instance is to be created."
description: |
Network configuration options. These are required when a private Data Fusion instance is to be created.
immutable: true
properties:
- name: 'ipAllocation'
Expand All @@ -235,42 +249,51 @@ properties:
immutable: true
- name: 'zone'
type: String
description: "Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field."
description: |
Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field.
immutable: true
default_from_api: true
- name: 'displayName'
type: String
description: "Display name for an instance."
description: |
Display name for an instance.
immutable: true
- name: 'apiEndpoint'
type: String
description: "Endpoint on which the REST APIs is accessible."
description: |
Endpoint on which the REST APIs is accessible.
output: true
- name: 'p4ServiceAccount'
type: String
description: "P4 service account for the customer project."
description: |
P4 service account for the customer project.
output: true
- name: 'cryptoKeyConfig'
type: NestedObject
description: "The crypto key configuration. This field is used by the Customer-Managed Encryption Keys (CMEK) feature."
description: |
The crypto key configuration. This field is used by the Customer-Managed Encryption Keys (CMEK) feature.
immutable: true
properties:
- name: 'keyReference'
type: String
description: "The name of the key which is used to encrypt/decrypt customer data. For key in Cloud KMS, the key should be in the format of projects/*/locations/*/keyRings/*/cryptoKeys/*."
description: |
The name of the key which is used to encrypt/decrypt customer data. For key in Cloud KMS, the key should be in the format of projects/*/locations/*/keyRings/*/cryptoKeys/*.
required: true
immutable: true
- name: 'eventPublishConfig'
type: NestedObject
description: "Option to enable and pass metadata for event publishing."
description: |
Option to enable and pass metadata for event publishing.
properties:
- name: 'enabled'
type: Boolean
description: "Option to enable Event Publishing."
description: |
Option to enable Event Publishing.
required: true
- name: 'topic'
type: String
description: "The resource name of the Pub/Sub topic. Format: projects/{projectId}/topics/{topic_id}"
description: |
The resource name of the Pub/Sub topic. Format: projects/{projectId}/topics/{topic_id}
required: true
immutable: true
- name: 'accelerators'
Expand All @@ -284,7 +307,8 @@ properties:
properties:
- name: 'acceleratorType'
type: Enum
description: "The type of an accelator for a CDF instance."
description: |
The type of an accelator for a CDF instance.
required: true
enum_values:
- 'CDC'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/datafusion/go_product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a temporary file, and should not be edited directly
---
name: 'DataFusion'
display_name: 'Cloud Data Fusion'
Expand Down
3 changes: 3 additions & 0 deletions mmv1/products/datafusion/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a deprecated file, please edit the go_ version in the same
# directory

--- !ruby/object:Api::Product
name: DataFusion
display_name: Cloud Data Fusion
Expand Down
3 changes: 3 additions & 0 deletions mmv1/products/pubsub/Schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a deprecated file, please edit the go_ version in the same
# directory

--- !ruby/object:Api::Resource
name: 'Schema'
description: |
Expand Down
3 changes: 3 additions & 0 deletions mmv1/products/pubsub/Subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a deprecated file, please edit the go_ version in the same
# directory

--- !ruby/object:Api::Resource
name: 'Subscription'
description: |
Expand Down
3 changes: 3 additions & 0 deletions mmv1/products/pubsub/Topic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a deprecated file, please edit the go_ version in the same
# directory

--- !ruby/object:Api::Resource
name: 'Topic'
description: |
Expand Down
7 changes: 4 additions & 3 deletions mmv1/products/pubsub/go_Schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Warning: This is a temporary file, and should not be edited directly
---
name: 'Schema'
description: |
Expand Down Expand Up @@ -58,7 +57,9 @@ examples:
parameters:
- name: 'name'
type: String
description: "The ID to use for the schema, which will become the final component of the schema's resource name."
description:
The ID to use for the schema, which will become the final component of the
schema's resource name.
required: true
immutable: true
diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName'
Expand All @@ -67,7 +68,7 @@ parameters:
properties:
- name: 'type'
type: Enum
description: "The type of the schema definition"
description: The type of the schema definition
default_value: TYPE_UNSPECIFIED
enum_values:
- 'TYPE_UNSPECIFIED'
Expand Down
Loading