MCPcopy Create free account
hub / github.com/PowerShell/DSC / invoke

Method invoke

lib/dsc-lib/src/functions/resource_id.rs:31–42  ·  view source on GitHub ↗
(&self, args: &[Value], _context: &Context)

Source from the content-addressed store, hash-verified

29 }
30
31 fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> {
32 // first argument is the type and must contain only 1 slash
33 let resource_type = &args[0].as_str().unwrap();
34 let slash_count = resource_type.chars().filter(|c| *c == '/').count();
35 if slash_count != 1 {
36 return Err(DscError::Function("resourceId".to_string(), t!("functions.resourceId.incorrectTypeFormat").to_string()));
37 }
38
39 let resource_name = &args[1].as_str().unwrap();
40 let result = resource_id(resource_type, resource_name);
41 Ok(Value::String(result))
42 }
43}
44
45#[cfg(test)]

Callers

nothing calls this directly

Calls 3

resource_idFunction · 0.85
as_strMethod · 0.80
FunctionInterface · 0.70

Tested by

no test coverage detected