| 999 | } // namespace |
| 1000 | |
| 1001 | absl::StatusOr<Config> EnvConfigFromYaml(const std::string& yaml) { |
| 1002 | Config config; |
| 1003 | CEL_ASSIGN_OR_RETURN(YAML::Node root, LoadYaml(yaml)); |
| 1004 | if (!root.IsDefined() || root.IsNull()) { |
| 1005 | return config; |
| 1006 | } |
| 1007 | |
| 1008 | if (!root.IsMap()) { |
| 1009 | return absl::InvalidArgumentError(FormatYamlErrorMessage( |
| 1010 | yaml, "Invalid CEL environment config YAML", root.Mark())); |
| 1011 | } |
| 1012 | |
| 1013 | CEL_RETURN_IF_ERROR(ParseName(config, yaml, root)); |
| 1014 | CEL_RETURN_IF_ERROR(ParseContainerConfig(config, yaml, root)); |
| 1015 | CEL_RETURN_IF_ERROR(ParseExtensionConfigs(config, yaml, root)); |
| 1016 | CEL_RETURN_IF_ERROR(ParseStandardLibraryConfig(config, yaml, root)); |
| 1017 | CEL_RETURN_IF_ERROR(ParseVariableConfigs(config, yaml, root)); |
| 1018 | CEL_RETURN_IF_ERROR(ParseFunctionConfigs(config, yaml, root)); |
| 1019 | return config; |
| 1020 | } |
| 1021 | |
| 1022 | void EnvConfigToYaml(const Config& env_config, std::ostream& os) { |
| 1023 | YAML::Emitter out(os); |