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

Function get_command_input

lib/dsc-lib/src/dscresources/command_resource.rs:1066–1088  ·  view source on GitHub ↗
(input_kind: Option<&InputKind>, input: &str)

Source from the content-addressed store, hash-verified

1064}
1065
1066fn get_command_input(input_kind: Option<&InputKind>, input: &str) -> Result<CommandInput, DscError> {
1067 let mut env: Option<HashMap<String, String>> = None;
1068 let mut stdin: Option<String> = None;
1069 match input_kind {
1070 Some(InputKind::Env) => {
1071 debug!("{}", t!("dscresources.commandResource.parseAsEnvVars"));
1072 env = Some(json_to_hashmap(input)?);
1073 },
1074 Some(InputKind::Stdin) => {
1075 debug!("{}", t!("dscresources.commandResource.parseAsStdin"));
1076 stdin = Some(input.to_string());
1077 },
1078 None => {
1079 debug!("{}", t!("dscresources.commandResource.noInput"));
1080 // leave input as none
1081 },
1082 }
1083
1084 Ok(CommandInput {
1085 env,
1086 stdin,
1087 })
1088}
1089
1090fn verify_json_from_manifest(resource: &DscResource, json: &str, target_resource: Option<&DscResource>) -> Result<(), DscError> {
1091 trace!("{}", t!("dscresources.commandResource.verifyJson", resource = resource.type_name, json = json));

Callers 7

invoke_getFunction · 0.85
invoke_setFunction · 0.85
invoke_testFunction · 0.85
invoke_deleteFunction · 0.85
invoke_validateFunction · 0.85
invoke_exportFunction · 0.85
invoke_resolveFunction · 0.85

Calls 1

json_to_hashmapFunction · 0.85

Tested by

no test coverage detected