| 281 | } |
| 282 | |
| 283 | func parseExportFormat(s string) (runtimev1.ExportFormat, error) { |
| 284 | switch strings.ToLower(s) { |
| 285 | case "": |
| 286 | return runtimev1.ExportFormat_EXPORT_FORMAT_UNSPECIFIED, nil |
| 287 | case "csv": |
| 288 | return runtimev1.ExportFormat_EXPORT_FORMAT_CSV, nil |
| 289 | case "xlsx": |
| 290 | return runtimev1.ExportFormat_EXPORT_FORMAT_XLSX, nil |
| 291 | case "parquet": |
| 292 | return runtimev1.ExportFormat_EXPORT_FORMAT_PARQUET, nil |
| 293 | default: |
| 294 | if val, ok := runtimev1.ExportFormat_value[s]; ok { |
| 295 | return runtimev1.ExportFormat(val), nil |
| 296 | } |
| 297 | return runtimev1.ExportFormat_EXPORT_FORMAT_UNSPECIFIED, fmt.Errorf("invalid export format %q", s) |
| 298 | } |
| 299 | } |