MCPcopy Index your code
hub / github.com/PowerShell/DSC / schema

Function schema

dsc/src/resource_command.rs:301–328  ·  view source on GitHub ↗
(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, format: Option<&OutputFormat>)

Source from the content-addressed store, hash-verified

299}
300
301pub fn schema(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, format: Option<&OutputFormat>) {
302 let Some(resource) = get_resource(dsc, resource_type, version) else {
303 error!("{}", DscError::ResourceNotFound(resource_type.to_string(), version.map_or(String::new(), |v| v.to_string())));
304 exit(EXIT_DSC_RESOURCE_NOT_FOUND);
305 };
306 if resource.kind == Kind::Adapter {
307 error!("{}: {}", t!("resource_command.invalidOperationOnAdapter"), resource.type_name);
308 exit(EXIT_DSC_ERROR);
309 }
310
311 match resource.schema() {
312 Ok(json) => {
313 // verify is json
314 match serde_json::from_str::<serde_json::Value>(json.as_str()) {
315 Ok(_) => (),
316 Err(err) => {
317 error!("{err}");
318 exit(EXIT_JSON_ERROR);
319 }
320 }
321 write_object(&json, format, false);
322 }
323 Err(err) => {
324 error!("{err}");
325 exit(EXIT_DSC_ERROR);
326 }
327 }
328}
329
330pub fn export(dsc: &mut DscManager, resource_type: &FullyQualifiedTypeName, version: Option<&ResourceVersionReq>, input: &str, format: Option<&OutputFormat>) {
331 let Some(dsc_resource) = get_resource(dsc, resource_type, version) else {

Callers 1

resourceFunction · 0.85

Calls 4

get_resourceFunction · 0.85
write_objectFunction · 0.85
schemaMethod · 0.80
as_strMethod · 0.80

Tested by

no test coverage detected