Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dataproc WorkflowTemplate, rename REQUIRED_OVERRIDE #5249

Merged
merged 3 commits into from
Sep 28, 2021
Merged
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,611 changes: 867 additions & 744 deletions tpgtools/api/dataproc/beta/workflow_template.yaml

Large diffs are not rendered by default.

1,547 changes: 841 additions & 706 deletions tpgtools/api/dataproc/workflow_template.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tpgtools/override.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const (
GenerateIfNotSet = "GENERATE_IF_NOT_SET"
CustomListSize = "CUSTOM_LIST_SIZE_CONSTRAINT"
CustomDefault = "CUSTOM_DEFAULT"
CustomRequired = "REQUIRED_OVERRIDE"
CustomSchemaValues = "CUSTOM_SCHEMA_VALUES"
)

// Overrides represents the type a resource's override file can be marshalled
Expand Down
3 changes: 1 addition & 2 deletions tpgtools/override_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ type CustomListSizeConstraintDetails struct {
Max int64
}

type CustomRequiredDetails struct {
type CustomSchemaValuesDetails struct {
Required bool
Optional bool
Computed bool
ForceNew bool
}

type ImportFormatDetails struct {
Expand Down
2 changes: 1 addition & 1 deletion tpgtools/overrides/compute/beta/forwarding_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
details:
title: forwarding_rule
location: region
- type: REQUIRED_OVERRIDE
- type: CUSTOM_SCHEMA_VALUES
location: global
field: target
details:
Expand Down
2 changes: 1 addition & 1 deletion tpgtools/overrides/compute/forwarding_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
details:
title: forwarding_rule
location: region
- type: REQUIRED_OVERRIDE
- type: CUSTOM_SCHEMA_VALUES
location: global
field: target
details:
Expand Down
11 changes: 11 additions & 0 deletions tpgtools/overrides/dataproc/beta/workflow_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: CUSTOM_SCHEMA_VALUES
field: version
details:
required: false
optional: true
computed: true
- type: DEPRECATED
field: version
details:
message: >-
version is not useful as a configurable field, and will be removed in the future.
11 changes: 11 additions & 0 deletions tpgtools/overrides/dataproc/workflow_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: CUSTOM_SCHEMA_VALUES
field: version
details:
required: false
optional: true
computed: true
- type: DEPRECATED
field: version
details:
message: >-
version is not useful as a configurable field, and will be removed in the future.
24 changes: 14 additions & 10 deletions tpgtools/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,17 +632,21 @@ func createPropertiesFromSchema(schema *openapi.Schema, typeFetcher *TypeFetcher
} else {
p.Optional = true
}
cr := CustomRequiredDetails{}
crOk, err := overrides.PropertyOverrideWithDetails(CustomRequired, p, &cr, location)
if err != nil {
return nil, fmt.Errorf("failed to decode custom required details")
}
if crOk {
p.Required = cr.Required
p.Optional = cr.Optional
p.Computed = cr.Computed
}
}
cr := CustomSchemaValuesDetails{}
crOk, err := overrides.PropertyOverrideWithDetails(CustomSchemaValues, p, &cr, location)
if err != nil {
return nil, fmt.Errorf("failed to decode custom required details")
}
if crOk {
p.Required = cr.Required
p.Optional = cr.Optional
p.Computed = cr.Computed
}

// Handle settable fields. If the field is computed it's not settable but
// if it's also optional (O+C), it is.
if !p.Computed || (p.Optional) {
p.Settable = true

// NOTE: x-kubernetes-immmutable implies that all children of a field
Expand Down