ByteReader/Writer support for serializing ResourceList.results field

This commit is contained in:
Phillip Wittrock
2020-04-09 09:23:30 -07:00
parent b1e48a46c7
commit b72db9e783
5 changed files with 683 additions and 396 deletions

View File

@@ -30,6 +30,8 @@ type ByteWriter struct {
// wrap the results in an ResourceList.
FunctionConfig *yaml.RNode
Results *yaml.RNode
// WrappingKind if set will cause ByteWriter to wrap the Resources in
// an 'items' field in this kind. e.g. if WrappingKind is 'List',
// ByteWriter will wrap the Resources in a List .items field.
@@ -112,6 +114,11 @@ func (w ByteWriter) Write(nodes []*yaml.RNode) error {
&yaml.Node{Kind: yaml.ScalarNode, Value: "functionConfig"},
w.FunctionConfig.YNode())
}
if w.Results != nil {
list.Content = append(list.Content,
&yaml.Node{Kind: yaml.ScalarNode, Value: "results"},
w.Results.YNode())
}
doc := &yaml.Node{
Kind: yaml.DocumentNode,
Content: []*yaml.Node{list}}