func parseKeysTemplate()

in cloudwatch/helpers.go [64:78]


func parseKeysTemplate(data map[interface{}]interface{}, keys string, w io.Writer) (int64, error) {
	return fasttemplate.ExecuteFunc(keys, "['", "']", w, func(w io.Writer, tag string) (int, error) {
		switch val := data[tag].(type) {
		case []byte:
			return w.Write(val)
		case string:
			return w.Write([]byte(val))
		case map[interface{}]interface{}:
			data = val // drill down another level.
			return 0, nil
		default: // missing
			return 0, fmt.Errorf("%s: %w", tag, ErrMissingSubName)
		}
	})
}