| 1604 | } |
| 1605 | |
| 1606 | fn select_driver_config( |
| 1607 | config: &Option<prost_types::Struct>, |
| 1608 | driver_name: &str, |
| 1609 | ) -> Result<Option<prost_types::Struct>, Box<Status>> { |
| 1610 | let Some(config) = config else { |
| 1611 | return Ok(None); |
| 1612 | }; |
| 1613 | let Some(value) = config.fields.get(driver_name) else { |
| 1614 | return Ok(None); |
| 1615 | }; |
| 1616 | match value.kind.as_ref() { |
| 1617 | Some(prost_types::value::Kind::StructValue(inner)) => Ok(Some(inner.clone())), |
| 1618 | _ => Err(Box::new(Status::invalid_argument(format!( |
| 1619 | "template.driver_config.{driver_name} must be an object" |
| 1620 | )))), |
| 1621 | } |
| 1622 | } |
| 1623 | |
| 1624 | /// Extract typed CPU/memory quantities from the public `resources` Struct. |
| 1625 | /// |