Skip to content

Commit

Permalink
Update Dataproc WorkflowTemplate, rename REQUIRED_OVERRIDE (#5249)
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson authored Sep 28, 2021
1 parent c3f4192 commit bfe21aa
Show file tree
Hide file tree
Showing 9 changed files with 1,748 additions and 1,465 deletions.
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

0 comments on commit bfe21aa

Please sign in to comment.