MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / YamlStr

Function YamlStr

internal/node/node.go:183–196  ·  view source on GitHub ↗

Convert a node to a YAML string for troubleshooting

(node *yaml.Node)

Source from the content-addressed store, hash-verified

181
182// Convert a node to a YAML string for troubleshooting
183func YamlStr(node *yaml.Node) string {
184 if node == nil {
185 return "nil"
186 }
187 buf := strings.Builder{}
188 enc := yaml.NewEncoder(&buf)
189 enc.SetIndent(2)
190 err := enc.Encode(node)
191 if err != nil {
192 return fmt.Sprintf("%s", err)
193 }
194 s := buf.String()
195 return strings.TrimSpace(s)
196}
197
198// Remove a map key-value pair from node.Content
199func RemoveFromMap(node *yaml.Node, name string) error {

Callers 15

FnJoinFunction · 0.92
FnMergeFunction · 0.92
FnSelectFunction · 0.92
FnInsertFileFunction · 0.92
FnInvokeMethod · 0.92
processMapsFunction · 0.92
replaceTemplateConstantsFunction · 0.92
TestProcessConditionsFunction · 0.92
ProcessConditionsMethod · 0.92
EvalCondMethod · 0.92
EvalAndMethod · 0.92
EvalOrMethod · 0.92

Calls 1

StringMethod · 0.65

Tested by 2

TestProcessConditionsFunction · 0.74
TestMatchWithParentCheckFunction · 0.74