pub fn parse_worker_capabilities(
workflows: Option<&str>,
tags: Option<&str>,
) -> Result<Option<WorkerCapabilities>, ApiError>Expand description
Parse the workflows and tags query parameters a worker sends.
Both are comma-separated lists. When neither is present the worker
predates routing: None is returned and it takes every run. When only
tags is present the worker accepts any workflow. An empty tags value
means a worker carrying no tag: it only takes runs that require none.
§Errors
Returns ApiError::BadRequest when a tag is invalid (see
validate_worker_tags).
§Examples
use ironflow_api::entities::parse_worker_capabilities;
assert!(parse_worker_capabilities(None, None)?.is_none());
let caps = parse_worker_capabilities(Some("deploy,build"), Some("region:eu,gpu"))?
.expect("capabilities were sent");
assert_eq!(caps.workflows, Some(vec!["build".to_string(), "deploy".to_string()]));
assert_eq!(caps.tags, vec!["gpu".to_string(), "region:eu".to_string()]);