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

Method new

lib/dsc-lib/src/configure/mod.rs:447–462  ·  view source on GitHub ↗

Create a new `Configurator` instance. # Arguments `config` - The configuration to use in JSON. # Errors This function will return an error if the configuration is invalid or the underlying discovery fails.

(json: &str, progress_format: ProgressFormat)

Source from the content-addressed store, hash-verified

445 ///
446 /// This function will return an error if the configuration is invalid or the underlying discovery fails.
447 pub fn new(json: &str, progress_format: ProgressFormat) -> Result<Configurator, DscError> {
448 let discovery = Discovery::new();
449 let mut config = Configurator {
450 json: json.to_owned(),
451 config: Configuration::new(),
452 context: Context::new(),
453 discovery: discovery.clone(),
454 statement_parser: Statement::new()?,
455 progress_format,
456 };
457 config.validate_config()?;
458 for extension in discovery.extensions.values() {
459 config.context.extensions.push(extension.clone());
460 }
461 Ok(config)
462 }
463
464 /// Get the configuration.
465 ///

Callers

nothing calls this directly

Calls 3

validate_configMethod · 0.80
valuesMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected