Skip to content

Commit 06bffb9

Browse files
authored
pass optype to setResourceReadMany from SetResource (#630)
Description of changes: Currently, if the resource output shape is a list, code-gen triggers the readmany output generator. When doing so, it does not pass the operationType, which causes it to lose some of its functionality, which in this case was the ability to ignore setting resources for a desired method. With these changes, even sdk outputs that have a list as output type will be able to configure Create/Update/Delete set config in generator.yaml By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent a3d580f commit 06bffb9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/generate/code/set_resource.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func SetResource(
123123
if op == r.Ops.ReadMany {
124124
return setResourceReadMany(
125125
cfg, r,
126-
op, sourceVarName, targetVarName, indentLevel,
126+
opType, op, sourceVarName, targetVarName, indentLevel,
127127
)
128128
} else if wrapperFieldPath != nil {
129129
// fieldpath api requires fully-qualified path
@@ -133,7 +133,7 @@ func SetResource(
133133
if sref.Shape.Type == "list" {
134134
return setResourceReadMany(
135135
cfg, r,
136-
op, sourceVarName, targetVarName, indentLevel,
136+
opType, op, sourceVarName, targetVarName, indentLevel,
137137
)
138138
}
139139
}
@@ -509,6 +509,8 @@ func ListMemberNameInReadManyOutput(
509509
func setResourceReadMany(
510510
cfg *ackgenconfig.Config,
511511
r *model.CRD,
512+
// the operation type
513+
opType model.OpType,
512514
// The ReadMany operation descriptor
513515
op *awssdkmodel.Operation,
514516
// String representing the name of the variable that we will grab the
@@ -660,7 +662,7 @@ func setResourceReadMany(
660662

661663
// We may have some special instructions for how to handle setting the
662664
// field value...
663-
setCfg := f.GetSetterConfig(model.OpTypeList)
665+
setCfg := f.GetSetterConfig(opType)
664666

665667
if setCfg != nil && setCfg.IgnoreResourceSetter() {
666668
continue

0 commit comments

Comments
 (0)