Return a required Vertex AI config value, or a `FailedPrecondition` status.
(
config: &'a std::collections::HashMap<String, String>,
key: &str,
)
| 300 | |
| 301 | /// Return a required Vertex AI config value, or a `FailedPrecondition` status. |
| 302 | fn required_vertex_config<'a>( |
| 303 | config: &'a std::collections::HashMap<String, String>, |
| 304 | key: &str, |
| 305 | ) -> Result<&'a str, Status> { |
| 306 | config |
| 307 | .get(key) |
| 308 | .map(String::as_str) |
| 309 | .filter(|v| !v.trim().is_empty()) |
| 310 | .ok_or_else(|| { |
| 311 | Status::failed_precondition(format!("Vertex AI provider requires {key} config")) |
| 312 | }) |
| 313 | } |
| 314 | |
| 315 | /// Validate a GCP project ID against the documented format. |
| 316 | /// |
no test coverage detected