Microsoft.Management.Configuration.idl (54801B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 namespace Microsoft.Management.Configuration 4 { 5 [contractversion(4)] 6 apicontract Contract{}; 7 8 // The current state of a configuration set. 9 [contract(Microsoft.Management.Configuration.Contract, 1)] 10 enum ConfigurationSetState 11 { 12 // The state of the configuration set is unknown. 13 Unknown, 14 // The configuration set is in the queue to be applied. 15 Pending, 16 // The configuration set is actively being applied. 17 InProgress, 18 // The configuration set has completed being applied. 19 Completed, 20 }; 21 22 // The current state of a configuration unit. 23 [contract(Microsoft.Management.Configuration.Contract, 1)] 24 enum ConfigurationUnitState 25 { 26 // The state of the configuration unit is unknown. 27 Unknown, 28 // The configuration unit is in the queue to be applied. 29 Pending, 30 // The configuration unit is actively being applied. 31 InProgress, 32 // The configuration unit has completed being applied. 33 Completed, 34 // The configuration unit was not applied due to external factors. 35 Skipped, 36 }; 37 38 // Defines the type of detail probing that is allowed about a configuration unit. 39 [contract(Microsoft.Management.Configuration.Contract, 1)] 40 [flags] 41 enum ConfigurationUnitDetailFlags 42 { 43 // For completeness. 44 None = 0, 45 // Only reads details from local data. 46 Local = 0x1, 47 // Can query the catalog information for details, but will not download any modules. 48 Catalog = 0x2, 49 // Can only read data, not write or execute. 50 ReadOnly = Local | Catalog, 51 // Can download modules, but not load them. 52 Download = 0x4, 53 // Can load modules for details. 54 Load = 0x8, 55 }; 56 57 // The source of a result; for instance, the part of the system that generated a failure. 58 [contract(Microsoft.Management.Configuration.Contract, 1)] 59 enum ConfigurationUnitResultSource 60 { 61 // The source is not known, or more likely, there was no failure. 62 None, 63 // The result came from inside the configuration system; this is likely a bug. 64 Internal, 65 // The configuration set was ill formed. For instance, referencing a configuration unit 66 // that does not exist or a dependency that is not present. 67 ConfigurationSet, 68 // The external module that processes the configuration unit generated the result. 69 UnitProcessing, 70 // The system state is causing the error. 71 SystemState, 72 // The configuration unit was not run due to a precondition not being met. 73 // For example, if a dependency fails to be applied, this will be set. 74 Precondition, 75 }; 76 77 // A security context; typically used to define the context in which a configuration unit should be processed. 78 [contract(Microsoft.Management.Configuration.Contract, 3)] 79 enum SecurityContext 80 { 81 // The default value; indicates that the configuration unit should be processed at the caller's current level. 82 Current, 83 // A standard user without administrator privileges. 84 Restricted, 85 // A user with administrator privileges. 86 Elevated, 87 }; 88 89 // Information about the environment in which a configuration is processed. 90 [contract(Microsoft.Management.Configuration.Contract, 3)] 91 runtimeclass ConfigurationEnvironment 92 { 93 // The security context in which a configuration is processed. 94 SecurityContext Context; 95 96 // A string that identifies the processor that should be used for the configuration. 97 String ProcessorIdentifier; 98 99 // Processor specific properties. 100 Windows.Foundation.Collections.IMap<String, String> ProcessorProperties{ get; }; 101 }; 102 103 // Information on a result for a single unit of configuration. 104 [contract(Microsoft.Management.Configuration.Contract, 1)] 105 interface IConfigurationUnitResultInformation 106 { 107 // The error code of the failure. 108 HRESULT ResultCode{ get; }; 109 110 // The short description of the failure. 111 String Description{ get; }; 112 113 // A more detailed error message appropriate for diagnosing the root cause of an error. 114 String Details{ get; }; 115 116 // The source of the result. 117 ConfigurationUnitResultSource ResultSource{ get; }; 118 } 119 120 // Provides information for a specific configuration unit setting. 121 [contract(Microsoft.Management.Configuration.Contract, 1)] 122 interface IConfigurationUnitSettingDetails 123 { 124 // The name of the setting. 125 String Identifier{ get; }; 126 // A brief description of the setting. 127 String Title{ get; }; 128 // The detailed description of the setting. 129 String Description{ get; }; 130 // Whether the setting is a key. This is used to determine if different settings are in conflict. 131 Boolean IsKey{ get; }; 132 // Whether a non-empty value for the setting is required. 133 Boolean IsRequired{ get; }; 134 // Whether the setting should be serialized in order to be applied on another system. 135 // When the current settings are retrieved from the system, this can be used to exclude settings that are not relevant to a future application of the unit of configuration. 136 Boolean IsInformational{ get; }; 137 // The data type for the value of this setting. 138 Windows.Foundation.PropertyType Type{ get; }; 139 140 // The schema fragment to be used for this setting. 141 // Using a single entry of the `properties` object from a JSON schema is suggested, for instance: 142 // { 143 // "$schema": "https://json-schema.org/draft/2020-12/schema", 144 // "scope": { 145 // "title": "Target scope", 146 // "description": "The scope at which the configuration should be applied.", 147 // "type": "string", 148 // "enum": [ 149 // "machine", 150 // "user" 151 // ] 152 // } 153 // } 154 String Schema{ get; }; 155 } 156 157 // Provides information for a specific configuration unit within the runtime. 158 [contract(Microsoft.Management.Configuration.Contract, 1)] 159 interface IConfigurationUnitProcessorDetails 160 { 161 // The type of configuration unit. 162 String UnitType{ get; }; 163 // A description of the unit of configuration. 164 String UnitDescription{ get; }; 165 // The URI of the documentation for the unit of configuration. 166 Windows.Foundation.Uri UnitDocumentationUri{ get; }; 167 // The URI of the icon for the unit of configuration. 168 Windows.Foundation.Uri UnitIconUri{ get; }; 169 // The name of the module containing the unit of configuration. 170 String ModuleName{ get; }; 171 // The type of the module containing the unit of configuration. 172 String ModuleType{ get; }; 173 // The source of the module containing the unit of configuration. 174 String ModuleSource{ get; }; 175 // The description of the module containing the unit of configuration. 176 String ModuleDescription{ get; }; 177 // The URI of the documentation for the module containing the unit of configuration. 178 Windows.Foundation.Uri ModuleDocumentationUri{ get; }; 179 // The URI for the published module containing the unit of configuration. 180 Windows.Foundation.Uri PublishedModuleUri{ get; }; 181 // The version of the module containing the unit of configuration. 182 String Version{ get; }; 183 // The publishing date of the module containing the unit of configuration. 184 Windows.Foundation.DateTime PublishedDate{ get; }; 185 // Whether the module is already present on the system. 186 Boolean IsLocal{ get; }; 187 // The author of the module containing the unit of configuration. 188 String Author{ get; }; 189 // The publisher of the module containing the unit of configuration. 190 String Publisher{ get; }; 191 // The signing information of the module files containing the unit of configuration. 192 // May contain Windows.Security.Cryptography.Certificates.Certificate or Windows.Security.Cryptography.Certificates.CertificateChain. 193 Windows.Foundation.Collections.IVectorView<IInspectable> SigningInformation{ get; }; 194 // The settings information for the unit of configuration. 195 Windows.Foundation.Collections.IVectorView<IConfigurationUnitSettingDetails> Settings{ get; }; 196 // Does it comes from a public repository 197 Boolean IsPublic{ get; }; 198 } 199 200 // Provides information for a specific configuration unit within the runtime. 201 [contract(Microsoft.Management.Configuration.Contract, 2)] 202 interface IConfigurationUnitProcessorDetails2 requires IConfigurationUnitProcessorDetails 203 { 204 // Determines if this configuration unit should be treated as a group. 205 Boolean IsGroup{ get; }; 206 } 207 208 // Provides information for a specific configuration unit within the runtime. 209 [contract(Microsoft.Management.Configuration.Contract, 4)] 210 interface IConfigurationUnitProcessorDetails3 requires IConfigurationUnitProcessorDetails2 211 { 212 // The path of the resource. 213 String Path{ get; }; 214 } 215 216 // Defines how the configuration unit is to be used within the configuration system. 217 [contract(Microsoft.Management.Configuration.Contract, 1)] 218 enum ConfigurationUnitIntent 219 { 220 // The configuration unit will only be used to Test the current system state. 221 Assert, 222 // The configuration unit will only be used to Get the current system state. 223 Inform, 224 // The configuration unit will be used to Apply the current system state. 225 // The configuration unit will be used to Test and Get the current system state as part of that process. 226 Apply, 227 // The configuration unit's intent is unknown. 228 // Currently not supported. 229 Unknown, 230 }; 231 232 // A single unit of configuration. 233 [contract(Microsoft.Management.Configuration.Contract, 1)] 234 runtimeclass ConfigurationUnit 235 { 236 // Creates an empty configuration unit for authoring purposes. 237 ConfigurationUnit(); 238 239 // The type of the unit being configured; not a name for this instance. 240 String Type; 241 242 // An identifier used to uniquely identify the instance of a configuration unit on the system. 243 // May change upon applying a configuration unit from a historical context if some part of the set changed. 244 Guid InstanceIdentifier{ get; }; 245 246 // The identifier name of this instance within the set. 247 String Identifier; 248 249 // Describes how this configuration unit will be used. 250 ConfigurationUnitIntent Intent; 251 252 // The `Identifier` values of the configuration units that this unit depends on. 253 Windows.Foundation.Collections.IVector<String> Dependencies; 254 255 // The metadata properties associated with the configuration unit. 256 // TODO: This is being used to drive processing decisions when it should not. 257 // There is ongoing discussion about this at https://github.com/PowerShell/DSC/issues/47 and https://github.com/PowerShell/DSC/issues/92. 258 Windows.Foundation.Collections.ValueSet Metadata; 259 260 // Contains the values that are for use by the configuration unit itself. 261 Windows.Foundation.Collections.ValueSet Settings; 262 263 // Contains information on the origin of the configuration unit. 264 // May be null if ConfigurationProcessor.GetDetailsAsync has not been called yet. 265 IConfigurationUnitProcessorDetails Details{ get; }; 266 267 // The current state of the configuration unit. 268 ConfigurationUnitState State{ get; }; 269 270 // Contains information on the result of the latest attempt to apply the configuration unit. 271 IConfigurationUnitResultInformation ResultInformation{ get; }; 272 273 // Controls whether this unit will be processed when part of a set. 274 Boolean IsActive; 275 276 // Creates a copy of this configuration unit, with the following notes: 277 // InstanceIdentifier will be a new value 278 // Identifier will be empty 279 // Dependencies, Metadata, and Settings will by new containers with identical values inside 280 // Details will be the same value (not a copy, just another reference) 281 // State, ResultInformation, and ShouldApply will be their default constructed state 282 // IsGroup will be false and child units will not be copied 283 // Environment will be copied 284 ConfigurationUnit Copy(); 285 286 [contract(Microsoft.Management.Configuration.Contract, 2)] 287 { 288 // Determines if this configuration unit should be treated as a group. 289 // A configuration unit group treats its `Settings` as the definition of child units. 290 Boolean IsGroup; 291 292 // The configuration units that are part of this unit (if IsGroup is true). 293 Windows.Foundation.Collections.IVector<ConfigurationUnit> Units; 294 } 295 296 [contract(Microsoft.Management.Configuration.Contract, 3)] 297 { 298 // The environment in which to process the configuration unit. 299 // This defines the initial processing environment state used by the configuration system, 300 // and may be overridden by the processor later. 301 ConfigurationEnvironment Environment{ get; }; 302 } 303 } 304 305 // The change event type that has occurred for a configuration set change. 306 [contract(Microsoft.Management.Configuration.Contract, 1)] 307 enum ConfigurationSetChangeEventType 308 { 309 Unknown, 310 // The change event was for the set state. Only ConfigurationSetChangeData.SetState is valid. 311 SetStateChanged, 312 // The change event was for the unit state. All ConfigurationSetChangeData properties are valid. 313 UnitStateChanged, 314 }; 315 316 // The change data sent about changes to a specific set. 317 [contract(Microsoft.Management.Configuration.Contract, 1)] 318 runtimeclass ConfigurationSetChangeData 319 { 320 // The change event type that occurred. 321 ConfigurationSetChangeEventType Change{ get; }; 322 323 // The state of the configuration set for this event (the ConfigurationSet can be used to get the current state, which may be different). 324 ConfigurationSetState SetState{ get; }; 325 326 // The state of the configuration unit for this event (the ConfigurationUnit can be used to get the current state, which may be different). 327 ConfigurationUnitState UnitState{ get; }; 328 329 // Contains information on the result of the attempt to apply the configuration unit. 330 IConfigurationUnitResultInformation ResultInformation{ get; }; 331 332 // The configuration unit whose state changed. 333 ConfigurationUnit Unit{ get; }; 334 } 335 336 // The definition of a configuration parameter; a value that may be provided to alter the processing of a configuration set. 337 [contract(Microsoft.Management.Configuration.Contract, 2)] 338 runtimeclass ConfigurationParameter 339 { 340 ConfigurationParameter(); 341 342 // The name of the parameter. 343 String Name; 344 345 // The description of the parameter. 346 String Description; 347 348 // The metadata properties associated with the configuration parameter. 349 Windows.Foundation.Collections.ValueSet Metadata; 350 351 // The value of the parameter should be treated as a secret; not logged our output. 352 Boolean IsSecure; 353 354 // The type of the parameter. 355 Windows.Foundation.PropertyType Type; 356 357 // The default value; may be null if no default is provided. 358 Object DefaultValue; 359 360 // The set of allowed values; a null container indicates that the values are not restricted. 361 Windows.Foundation.Collections.IVector<Object> AllowedValues; 362 363 // The minimum length for a parameter type with the concept (string, array, etc.). 364 UInt32 MinimumLength; 365 366 // The maximum length for a parameter type with the concept (string, array, etc.). 367 UInt32 MaximumLength; 368 369 // For comparable parameter types, the minimum value allowed (integrals, DateTime, etc.). 370 Object MinimumValue; 371 372 // For comparable parameter types, the maximum value allowed (integrals, DateTime, etc.). 373 Object MaximumValue; 374 375 // The input value; may be null if no value is provided. 376 Object ProvidedValue; 377 } 378 379 // A configuration set contains a collection of configuration units and details about the set. 380 [contract(Microsoft.Management.Configuration.Contract, 1)] 381 runtimeclass ConfigurationSet 382 { 383 // Creates an empty configuration set for authoring purposes. 384 ConfigurationSet(); 385 386 // The name of the set; if from a file this could be the file name. 387 String Name; 388 // The origin of the set; if it came from a repository it could be the remote URL (ex. https://github.com/microsoft/winget-cli.git). 389 String Origin; 390 // The location of the configuration set on the local filesystem. 391 // If this set is from history, the file may no longer exist or it's contents may have been changed. 392 String Path; 393 394 // An identifier used to uniquely identify the instance of a configuration set on the system. 395 // May change upon applying a configuration set from a historical context if some part of the set changed. 396 Guid InstanceIdentifier{ get; }; 397 // The state that the set is in. 398 ConfigurationSetState State{ get; }; 399 // The time that this set was recorded with intent to apply. 400 Windows.Foundation.DateTime FirstApply{ get; }; 401 // The time that this set was last started to be applied. 402 Windows.Foundation.DateTime ApplyBegun{ get; }; 403 // The time that this set was last finished being applied (does not indicate success). 404 Windows.Foundation.DateTime ApplyEnded{ get; }; 405 406 // The configuration units that are part of this set. 407 Windows.Foundation.Collections.IVector<ConfigurationUnit> Units; 408 409 // The schema version to use for the set. 410 // Will be set to the schema version when read in, and default to the latest if created manually. 411 // Setting SchemaVersion to a different value will change SchemaUri. 412 String SchemaVersion; 413 414 // Only changes for this set are sent to this event. 415 // This includes things like: start/stop of the entire set for application, start/stop of a unit for application. 416 event Windows.Foundation.TypedEventHandler<ConfigurationSet, ConfigurationSetChangeData> ConfigurationSetChange; 417 418 // Writes the configuration set to the given stream. 419 void Serialize(Windows.Storage.Streams.IOutputStream stream); 420 421 // Removes the configuration set from the recorded history, if present. 422 void Remove(); 423 424 [contract(Microsoft.Management.Configuration.Contract, 2)] 425 { 426 // The metadata properties associated with the configuration set. 427 Windows.Foundation.Collections.ValueSet Metadata; 428 429 // The parameters that this configuration set supports. 430 Windows.Foundation.Collections.IVector<ConfigurationParameter> Parameters; 431 432 // The variables that this configuration set uses. 433 Windows.Foundation.Collections.ValueSet Variables; 434 435 // The schema URI to use for the set. 436 // Will be set to the schema version when read in, and default to the latest if created manually. 437 // Setting SchemaUri to a different value will change SchemaVersion. 438 Windows.Foundation.Uri SchemaUri; 439 } 440 441 [contract(Microsoft.Management.Configuration.Contract, 3)] 442 { 443 // The environment in which to process the configuration set. 444 // This defines the initial processing environment state used by the configuration system, 445 // and may be overridden by the processor later. 446 ConfigurationEnvironment Environment{ get; }; 447 448 // Gets the union of environments as defined by all of the active units within the set. 449 Windows.Foundation.Collections.IVector<ConfigurationEnvironment> GetUnitEnvironments(); 450 } 451 } 452 453 // The result of applying the settings with an IConfigurationUnitProcessor. 454 [contract(Microsoft.Management.Configuration.Contract, 1)] 455 interface IApplySettingsResult 456 { 457 // The configuration unit. 458 ConfigurationUnit Unit{ get; }; 459 460 // Indicates whether a reboot is required after the settings were applied. 461 Boolean RebootRequired{ get; }; 462 463 // The result of applying the configuration unit. 464 IConfigurationUnitResultInformation ResultInformation{ get; }; 465 } 466 467 // Informs the caller of the result of running a Test. 468 [contract(Microsoft.Management.Configuration.Contract, 1)] 469 enum ConfigurationTestResult 470 { 471 // The result is unknown. 472 Unknown, 473 // The system is in the state described by the configuration. 474 Positive, 475 // The system is not in the state described by the configuration. 476 Negative, 477 // Running the test failed. 478 Failed, 479 // The test was not run because it was not applicable. 480 NotRun, 481 }; 482 483 // The result of testing the settings with an IConfigurationUnitProcessor. 484 [contract(Microsoft.Management.Configuration.Contract, 1)] 485 interface ITestSettingsResult 486 { 487 // The configuration unit. 488 ConfigurationUnit Unit{ get; }; 489 490 // The result (if any) of running Test on the configuration unit. 491 ConfigurationTestResult TestResult{ get; }; 492 493 // The result of testing the configuration unit. 494 // This is not the response for the test, but rather contains information about the actual attempt to run the test. 495 IConfigurationUnitResultInformation ResultInformation{ get; }; 496 } 497 498 // The result of getting the settings with an IConfigurationUnitProcessor. 499 [contract(Microsoft.Management.Configuration.Contract, 1)] 500 interface IGetSettingsResult 501 { 502 // The configuration unit. 503 ConfigurationUnit Unit{ get; }; 504 505 // The current state of the system for the configuration unit. 506 Windows.Foundation.Collections.ValueSet Settings{ get; }; 507 508 // The result of getting the configuration unit settings. 509 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 510 IConfigurationUnitResultInformation ResultInformation{ get; }; 511 } 512 513 // The result of getting the settings for all instances of a configuration unit. 514 [contract(Microsoft.Management.Configuration.Contract, 2)] 515 interface IGetAllSettingsResult 516 { 517 // The configuration unit. 518 ConfigurationUnit Unit{ get; }; 519 520 // The current state of the system for all the instances of the configuration unit. 521 Windows.Foundation.Collections.IVector<Windows.Foundation.Collections.ValueSet> Settings{ get; }; 522 523 // The result of getting the configuration unit settings. 524 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 525 IConfigurationUnitResultInformation ResultInformation{ get; }; 526 } 527 528 // The result of getting all of the units for a configuration unit. 529 [contract(Microsoft.Management.Configuration.Contract, 4)] 530 interface IGetAllUnitsResult 531 { 532 // The configuration unit. 533 ConfigurationUnit Unit{ get; }; 534 535 // The units retrieved for the given unit. 536 Windows.Foundation.Collections.IVector<ConfigurationUnit> Units{ get; }; 537 538 // The result of getting the configuration units. 539 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 540 IConfigurationUnitResultInformation ResultInformation{ get; }; 541 } 542 543 // Provides access to a specific configuration unit within the runtime. 544 [contract(Microsoft.Management.Configuration.Contract, 1)] 545 interface IConfigurationUnitProcessor 546 { 547 // The configuration unit that the processor was created for. 548 ConfigurationUnit Unit{ get; }; 549 550 // Determines if the system is already in the state described by the configuration unit. 551 ITestSettingsResult TestSettings(); 552 553 // Gets the current system state for the configuration unit. 554 IGetSettingsResult GetSettings(); 555 556 // Applies the state described in the configuration unit. 557 IApplySettingsResult ApplySettings(); 558 } 559 560 [contract(Microsoft.Management.Configuration.Contract, 2)] 561 interface IGetAllSettingsConfigurationUnitProcessor requires IConfigurationUnitProcessor 562 { 563 // Gets the current system state for all the instances of the configuration unit, each of which has their own settings. 564 IGetAllSettingsResult GetAllSettings(); 565 } 566 567 [contract(Microsoft.Management.Configuration.Contract, 4)] 568 interface IGetAllUnitsConfigurationUnitProcessor requires IConfigurationUnitProcessor 569 { 570 // Gets all units for the configuration unit. 571 IGetAllUnitsResult GetAllUnits(); 572 } 573 574 // Controls the lifetime of operations for a single configuration set. 575 [contract(Microsoft.Management.Configuration.Contract, 1)] 576 interface IConfigurationSetProcessor 577 { 578 // Gets the configuration unit processor details for the given unit. 579 IConfigurationUnitProcessorDetails GetUnitProcessorDetails(ConfigurationUnit unit, ConfigurationUnitDetailFlags detailFlags); 580 581 // Creates a configuration unit processor for the given unit. 582 IConfigurationUnitProcessor CreateUnitProcessor(ConfigurationUnit unit); 583 } 584 585 // The definition of find unit processors option. 586 [contract(Microsoft.Management.Configuration.Contract, 4)] 587 runtimeclass FindUnitProcessorsOptions 588 { 589 FindUnitProcessorsOptions(); 590 591 // Search paths for finding configuration unit processors. The value has the same format as 592 // PATH environment variable. Paths are absolute paths separated by semicolons(;). 593 String SearchPaths; 594 595 // If the search paths provided are exclusive. 596 Boolean SearchPathsExclusive; 597 598 // Defines the type of detail probing that is allowed when finding unit processors. 599 ConfigurationUnitDetailFlags UnitDetailFlags; 600 } 601 602 // Find unit processors. 603 [contract(Microsoft.Management.Configuration.Contract, 4)] 604 interface IFindUnitProcessorsSetProcessor requires IConfigurationSetProcessor 605 { 606 // Find unit processors. 607 Windows.Foundation.Collections.IVector<IConfigurationUnitProcessorDetails> FindUnitProcessors(FindUnitProcessorsOptions findOptions); 608 } 609 610 // The result of applying an individual unit settings with an IConfigurationGroupProcessor. 611 [contract(Microsoft.Management.Configuration.Contract, 1)] 612 interface IApplyGroupMemberSettingsResult 613 { 614 // The configuration unit. 615 ConfigurationUnit Unit{ get; }; 616 617 // The state of the unit. 618 // Properties other than `Unit` are not valid unless this value is `Completed`. 619 ConfigurationUnitState State{ get; }; 620 621 // Will be true if the configuration unit was in the desired state (Test returns true) prior to the apply action. 622 Boolean PreviouslyInDesiredState{ get; }; 623 624 // Indicates whether a reboot is required after the settings were applied. 625 Boolean RebootRequired{ get; }; 626 627 // The result of applying the configuration unit. 628 IConfigurationUnitResultInformation ResultInformation{ get; }; 629 } 630 631 // The result of applying the settings with an IConfigurationGroupProcessor. 632 [contract(Microsoft.Management.Configuration.Contract, 2)] 633 interface IApplyGroupSettingsResult 634 { 635 // The configuration group object (set or unit). 636 Object Group{ get; }; 637 638 // Indicates whether a reboot is required after the settings were applied. 639 Boolean RebootRequired{ get; }; 640 641 // The result of applying the configuration unit group. 642 IConfigurationUnitResultInformation ResultInformation{ get; }; 643 644 // Results for each configuration unit in the group. 645 Windows.Foundation.Collections.IVector<IApplyGroupMemberSettingsResult> UnitResults{ get; }; 646 } 647 648 // The result of testing the settings with an IConfigurationGroupProcessor. 649 [contract(Microsoft.Management.Configuration.Contract, 2)] 650 interface ITestGroupSettingsResult 651 { 652 // The configuration group object (set or unit). 653 Object Group{ get; }; 654 655 // The result (if any) of running Test on the configuration unit group. 656 ConfigurationTestResult TestResult{ get; }; 657 658 // The result of testing the configuration unit group. 659 // This is not the response for the test, but rather contains information about the actual attempt to run the test. 660 IConfigurationUnitResultInformation ResultInformation{ get; }; 661 662 // Results for each configuration unit in the group. 663 Windows.Foundation.Collections.IVector<ITestSettingsResult> UnitResults{ get; }; 664 } 665 666 // Provides access to a specific configuration unit group within the runtime. 667 // An object returned by `CreateUnitProcessor` or `CreateSetProcessor` can implement this interface to indicate that it can take 668 // the responsibility of executing the units that it contains. 669 [contract(Microsoft.Management.Configuration.Contract, 2)] 670 interface IConfigurationGroupProcessor 671 { 672 // The configuration group object (set or unit). 673 Object Group{ get; }; 674 675 // Determines if the system is already in the state described by the configuration unit group. 676 // Progress is expected for every descendant unit and finally the group unit itself. 677 Windows.Foundation.IAsyncOperation<ITestGroupSettingsResult> TestGroupSettingsAsync(Windows.Foundation.EventHandler<ITestSettingsResult> progressHandler); 678 679 // Applies the state described in the configuration unit group. 680 // Progress is expected for every descendant unit and finally the group unit itself. 681 Windows.Foundation.IAsyncOperation<IApplyGroupSettingsResult> ApplyGroupSettingsAsync(Windows.Foundation.EventHandler<IApplyGroupMemberSettingsResult> progressHandler); 682 } 683 684 // The level of the diagnostic information. 685 [contract(Microsoft.Management.Configuration.Contract, 1)] 686 enum DiagnosticLevel 687 { 688 Verbose, 689 Informational, 690 Warning, 691 Error, 692 Critical, 693 }; 694 695 // Enables diagnostic information from the configuration system to be inspected/stored by callers. 696 [contract(Microsoft.Management.Configuration.Contract, 1)] 697 interface IDiagnosticInformation 698 { 699 // Indicates the importance of the diagnostic information. 700 DiagnosticLevel Level{ get; }; 701 702 // The diagnostic message. 703 String Message{ get; }; 704 } 705 706 // Allows different runtimes to provide specialized handling of configuration processing. 707 [contract(Microsoft.Management.Configuration.Contract, 1)] 708 interface IConfigurationSetProcessorFactory 709 { 710 // Creates a configuration set processor for the given set. 711 IConfigurationSetProcessor CreateSetProcessor(ConfigurationSet configurationSet); 712 713 // Diagnostics event; useful for logging and/or verbose output. 714 event Windows.Foundation.EventHandler<IDiagnosticInformation> Diagnostics; 715 716 // Indicates the minimum importance desired for diagnostics. 717 DiagnosticLevel MinimumLevel; 718 } 719 720 // The change event type that has occurred. 721 [contract(Microsoft.Management.Configuration.Contract, 1)] 722 enum ConfigurationChangeEventType 723 { 724 Unknown, 725 SetAdded, 726 SetStateChanged, 727 SetRemoved, 728 }; 729 730 // The change data sent about changes to sets. 731 [contract(Microsoft.Management.Configuration.Contract, 1)] 732 runtimeclass ConfigurationChangeData 733 { 734 // The change event type that occurred. 735 ConfigurationChangeEventType Change{ get; }; 736 737 // The identifier used to uniquely identify the instance of a configuration set on the system. 738 Guid InstanceIdentifier{ get; }; 739 740 // The state of the configuration set for this event (the ConfigurationSet can be used to get the current state, which may be different). 741 ConfigurationSetState State{ get; }; 742 } 743 744 // The result of calling OpenConfigurationSet, containing either the set or details about the failure. 745 [contract(Microsoft.Management.Configuration.Contract, 1)] 746 runtimeclass OpenConfigurationSetResult 747 { 748 // The configuration set if successful; null otherwise. 749 ConfigurationSet Set{ get; }; 750 751 // The result from opening the set. 752 HRESULT ResultCode{ get; }; 753 754 // The field that is missing/invalid, if appropriate for the specific ResultCode. 755 String Field{ get; }; 756 757 // The value of the field, if appropriate for the specific ResultCode. 758 String Value{ get; }; 759 760 // The line number for the failure reason, if determined. 761 UInt32 Line{ get; }; 762 763 // The column number for the failure reason, if determined. 764 UInt32 Column{ get; }; 765 } 766 767 // The type of conflict between configuration sets that was detected. 768 [contract(Microsoft.Management.Configuration.Contract, 1)] 769 enum ConfigurationConflictType 770 { 771 Unknown, 772 // Indicates that the first configuration set has a matching name and origin to the second, which has already been applied. 773 // This is likely an update to the existing set, and should be applied as such, rather than an entirely new set. 774 MatchingOrigin, 775 // Indicates that the first configuration set is identical to the second, which has already been applied. 776 // This is based solely on the configuration unit settings. 777 IdenticalSetApplied, 778 // Indicates a conflict between the settings of two configuration units. 779 SettingsConflict, 780 }; 781 782 // Describes a conflict between a setting of two configuration units. 783 [contract(Microsoft.Management.Configuration.Contract, 1)] 784 runtimeclass ConfigurationConflictSetting 785 { 786 // The name of the setting. 787 String Name{ get; }; 788 789 // The value from the first configuration unit. 790 // These are the values from a `ValueSet`, and are thus required to be a `PropertyValue` or a 'ValueSet`. 791 Object FirstValue{ get; }; 792 793 // The value from the second configuration unit. 794 // These are the values from a `ValueSet`, and are thus required to be a `PropertyValue` or a 'ValueSet`. 795 Object SecondValue{ get; }; 796 } 797 798 // Describes a conflict between two configuration sets. 799 [contract(Microsoft.Management.Configuration.Contract, 1)] 800 runtimeclass ConfigurationConflict 801 { 802 // The type of conflict detected. 803 ConfigurationConflictType Conflict{ get; }; 804 805 // The first of the configuration sets involved in the conflict. 806 ConfigurationSet FirstSet{ get; }; 807 808 // The second of the configuration sets involved in the conflict. 809 ConfigurationSet SecondSet{ get; }; 810 811 // The first of the configuration units involved in the conflict. 812 ConfigurationUnit FirstUnit{ get; }; 813 814 // The second of the configuration units involved in the conflict. 815 ConfigurationUnit SecondUnit{ get; }; 816 817 // Contains information about the particular settings that are conflicting. 818 Windows.Foundation.Collections.IVectorView<ConfigurationConflictSetting> Settings{ get; }; 819 } 820 821 // The result of getting the configuration unit details. 822 [contract(Microsoft.Management.Configuration.Contract, 1)] 823 runtimeclass GetConfigurationUnitDetailsResult 824 { 825 // The configuration unit whose details were retrieved. 826 ConfigurationUnit Unit{ get; }; 827 828 // The details, if they were able to be acquired successfully. 829 IConfigurationUnitProcessorDetails Details{ get; }; 830 831 // The result of getting the configuration unit details. 832 IConfigurationUnitResultInformation ResultInformation{ get; }; 833 } 834 835 // The result of getting the configuration set details. 836 [contract(Microsoft.Management.Configuration.Contract, 1)] 837 runtimeclass GetConfigurationSetDetailsResult 838 { 839 // The configuration unit whose details were retrieved. 840 Windows.Foundation.Collections.IVectorView<GetConfigurationUnitDetailsResult> UnitResults{ get; }; 841 } 842 843 // Flags to control how a configuration set should be applied to the system. 844 [contract(Microsoft.Management.Configuration.Contract, 1)] 845 [flags] 846 enum ApplyConfigurationSetFlags 847 { 848 None = 0x0, 849 // Forces a new configuration set instance to be recorded when the set being applied matches a previous set's origin. 850 // The default behavior is to assume that the incoming set is an update to the existing set and overwrite it. 851 DoNotOverwriteMatchingOriginSet = 0x1, 852 // Does not apply the configuration set, only checks the configuration set for internal consistency. 853 PerformConsistencyCheckOnly = 0x2, 854 }; 855 856 // The result of applying the settings for a configuration unit. 857 [contract(Microsoft.Management.Configuration.Contract, 1)] 858 runtimeclass ApplyConfigurationUnitResult 859 { 860 // The configuration unit that was applied. 861 ConfigurationUnit Unit{ get; }; 862 863 // The state of the configuration unit with regards to the current execution of ApplySet. 864 ConfigurationUnitState State{ get; }; 865 866 // Will be true if the configuration unit was in the desired state (Test returns true) prior to the apply action. 867 Boolean PreviouslyInDesiredState{ get; }; 868 869 // Indicates whether a reboot is required after the configuration unit was applied. 870 Boolean RebootRequired{ get; }; 871 872 // The result of applying the configuration unit. 873 IConfigurationUnitResultInformation ResultInformation{ get; }; 874 } 875 876 // The result of applying the settings for a configuration set. 877 [contract(Microsoft.Management.Configuration.Contract, 1)] 878 runtimeclass ApplyConfigurationSetResult 879 { 880 // Results for each configuration unit in the set. 881 Windows.Foundation.Collections.IVectorView<ApplyConfigurationUnitResult> UnitResults{ get; }; 882 883 // The overall result from applying the configuration set. 884 HRESULT ResultCode{ get; }; 885 } 886 887 // The result of testing the settings for a configuration unit. 888 [contract(Microsoft.Management.Configuration.Contract, 1)] 889 runtimeclass TestConfigurationUnitResult 890 { 891 // The configuration unit that was tested. 892 ConfigurationUnit Unit{ get; }; 893 894 // The result of testing the configuration unit. 895 // This is not the response for the test, but rather contains information about the actual attempt to run the test. 896 IConfigurationUnitResultInformation ResultInformation{ get; }; 897 898 // The result (if any) of running Test on the configuration unit. 899 ConfigurationTestResult TestResult{ get; }; 900 } 901 902 // The result of testing the settings for a configuration set. 903 [contract(Microsoft.Management.Configuration.Contract, 1)] 904 runtimeclass TestConfigurationSetResult 905 { 906 // Results for each configuration unit in the set. 907 Windows.Foundation.Collections.IVectorView<TestConfigurationUnitResult> UnitResults{ get; }; 908 909 // The result (if any) of running Test on the configuration set. 910 // If this value is NotRun, every unit result will be NotRun. 911 // If this value is Positive, every unit result will be Positive (or NotRun with at least one being Positive). 912 // Any Negative result for a unit will result in this value being Negative. 913 // Any Failed result for a unit will result in this value being Failed (overriding the Negative statement above). 914 ConfigurationTestResult TestResult{ get; }; 915 } 916 917 // The result of getting the settings for a configuration unit. 918 [contract(Microsoft.Management.Configuration.Contract, 1)] 919 runtimeclass GetConfigurationUnitSettingsResult 920 { 921 // The result of getting the configuration unit settings. 922 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 923 IConfigurationUnitResultInformation ResultInformation{ get; }; 924 925 // The current state of the system for the configuration unit. 926 Windows.Foundation.Collections.ValueSet Settings { get; }; 927 } 928 929 // The result of getting the settings for all the instances of a configuration unit. 930 [contract(Microsoft.Management.Configuration.Contract, 2)] 931 runtimeclass GetAllConfigurationUnitSettingsResult 932 { 933 // The result of getting the settings for all the instances of the configuration unit. 934 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 935 IConfigurationUnitResultInformation ResultInformation{ get; }; 936 937 // The current state of the system for all the instances of the configuration unit. 938 Windows.Foundation.Collections.IVector<Windows.Foundation.Collections.ValueSet> Settings { get; }; 939 } 940 941 // The result of getting the all units for a configuration unit. 942 [contract(Microsoft.Management.Configuration.Contract, 4)] 943 runtimeclass GetAllConfigurationUnitsResult 944 { 945 // The result of getting the all units for a configuration unit. 946 // This is not the response for the retrieval, but rather contains information about the actual attempt to retrieve the settings. 947 IConfigurationUnitResultInformation ResultInformation{ get; }; 948 949 // The units retrieved for the given unit. 950 Windows.Foundation.Collections.IVector<ConfigurationUnit> Units { get; }; 951 } 952 953 // The configuration processor is responsible for the interactions with the system. 954 [contract(Microsoft.Management.Configuration.Contract, 1)] 955 runtimeclass ConfigurationProcessor 956 { 957 ConfigurationProcessor(IConfigurationSetProcessorFactory factory); 958 959 // Diagnostics event; useful for logging and/or verbose output. 960 event Windows.Foundation.EventHandler<IDiagnosticInformation> Diagnostics; 961 962 // Indicates the minimum importance desired for diagnostics. 963 DiagnosticLevel MinimumLevel; 964 965 // Set the caller to used to identify the usage in telemetry events. 966 String Caller; 967 968 // The identifier for the current activity, enabling multiple calls into the processor to be correlated. 969 Guid ActivityIdentifier; 970 971 // If true, ETW events will be generated. Some of those events may be sent to Microsoft depending on the system settings. 972 Boolean GenerateTelemetryEvents; 973 974 // Only top level configuration changes are sent to this event. 975 // This includes things like: creation of a new set for intent to run, start/stop of a set for application, deletion of a not started set. 976 event Windows.Foundation.TypedEventHandler<ConfigurationSet, ConfigurationChangeData> ConfigurationChange; 977 978 // Gets the configuration sets that have already been applied or with the intent to be applied (this may include in progress sets or those that are waiting on others). 979 Windows.Foundation.Collections.IVector<ConfigurationSet> GetConfigurationHistory(); 980 Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<ConfigurationSet> > GetConfigurationHistoryAsync(); 981 982 // Loads a configuration set from the given stream. 983 OpenConfigurationSetResult OpenConfigurationSet(Windows.Storage.Streams.IInputStream stream); 984 Windows.Foundation.IAsyncOperation<OpenConfigurationSetResult> OpenConfigurationSetAsync(Windows.Storage.Streams.IInputStream stream); 985 986 // Checks for conflicts amongst the configuration sets provided, optionally including the configuration sets already applied to the system. 987 Windows.Foundation.Collections.IVector<ConfigurationConflict> CheckForConflicts(Windows.Foundation.Collections.IVectorView<ConfigurationSet> configurationSets, Boolean includeConfigurationHistory); 988 Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<ConfigurationConflict> > CheckForConflictsAsync(Windows.Foundation.Collections.IVectorView<ConfigurationSet> configurationSets, Boolean includeConfigurationHistory); 989 990 // Gets the details for all configuration units in a set. 991 GetConfigurationSetDetailsResult GetSetDetails(ConfigurationSet configurationSet, ConfigurationUnitDetailFlags detailFlags); 992 Windows.Foundation.IAsyncOperationWithProgress<GetConfigurationSetDetailsResult, GetConfigurationUnitDetailsResult> GetSetDetailsAsync(ConfigurationSet configurationSet, ConfigurationUnitDetailFlags detailFlags); 993 994 // Gets the details for a configuration unit. 995 GetConfigurationUnitDetailsResult GetUnitDetails(ConfigurationUnit unit, ConfigurationUnitDetailFlags detailFlags); 996 Windows.Foundation.IAsyncOperation<GetConfigurationUnitDetailsResult> GetUnitDetailsAsync(ConfigurationUnit unit, ConfigurationUnitDetailFlags detailFlags); 997 998 // Applies the configuration set state. 999 ApplyConfigurationSetResult ApplySet(ConfigurationSet configurationSet, ApplyConfigurationSetFlags flags); 1000 Windows.Foundation.IAsyncOperationWithProgress<ApplyConfigurationSetResult, ConfigurationSetChangeData> ApplySetAsync(ConfigurationSet configurationSet, ApplyConfigurationSetFlags flags); 1001 1002 // Tests the configuration set state. 1003 TestConfigurationSetResult TestSet(ConfigurationSet configurationSet); 1004 Windows.Foundation.IAsyncOperationWithProgress<TestConfigurationSetResult, TestConfigurationUnitResult> TestSetAsync(ConfigurationSet configurationSet); 1005 1006 // Gets the current configuration unit settings. 1007 GetConfigurationUnitSettingsResult GetUnitSettings(ConfigurationUnit unit); 1008 Windows.Foundation.IAsyncOperation<GetConfigurationUnitSettingsResult> GetUnitSettingsAsync(ConfigurationUnit unit); 1009 1010 [contract(Microsoft.Management.Configuration.Contract, 2)] 1011 { 1012 // Gets the current settings for all the instances of a configuration unit. 1013 GetAllConfigurationUnitSettingsResult GetAllUnitSettings(ConfigurationUnit unit); 1014 Windows.Foundation.IAsyncOperation<GetAllConfigurationUnitSettingsResult> GetAllUnitSettingsAsync(ConfigurationUnit unit); 1015 } 1016 1017 [contract(Microsoft.Management.Configuration.Contract, 4)] 1018 { 1019 // Gets all configuration units for the given unit type. 1020 // Returned units may be of types other than the one passed in. 1021 GetAllConfigurationUnitsResult GetAllUnits(ConfigurationUnit unit); 1022 Windows.Foundation.IAsyncOperation<GetAllConfigurationUnitsResult> GetAllUnitsAsync(ConfigurationUnit unit); 1023 1024 // Find unit processors. 1025 Windows.Foundation.Collections.IVector<IConfigurationUnitProcessorDetails> FindUnitProcessors(FindUnitProcessorsOptions findOptions); 1026 Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<IConfigurationUnitProcessorDetails> > FindUnitProcessorsAsync(FindUnitProcessorsOptions findOptions); 1027 1028 // Apply the current configuration unit. 1029 ApplyConfigurationUnitResult ApplyUnit(ConfigurationUnit unit); 1030 Windows.Foundation.IAsyncOperation<ApplyConfigurationUnitResult> ApplyUnitAsync(ConfigurationUnit unit); 1031 1032 // Test the current configuration unit. 1033 TestConfigurationUnitResult TestUnit(ConfigurationUnit unit); 1034 Windows.Foundation.IAsyncOperation<TestConfigurationUnitResult> TestUnitAsync(ConfigurationUnit unit); 1035 } 1036 } 1037 1038 // Top level entry point for configuration, enabling easier usage in out-of-process scenarios. 1039 [contract(Microsoft.Management.Configuration.Contract, 1)] 1040 interface IConfigurationStatics 1041 { 1042 // Creates an empty configuration unit. 1043 ConfigurationUnit CreateConfigurationUnit(); 1044 1045 // Creates an empty configuration set. 1046 ConfigurationSet CreateConfigurationSet(); 1047 1048 // Creates a processor factory for the given handler. 1049 Windows.Foundation.IAsyncOperation<IConfigurationSetProcessorFactory> CreateConfigurationSetProcessorFactoryAsync(String handler); 1050 1051 // Creates a processor from the given factory. 1052 ConfigurationProcessor CreateConfigurationProcessor(IConfigurationSetProcessorFactory factory); 1053 1054 // Whether configuration is enabled. 1055 Boolean IsConfigurationAvailable{ get; }; 1056 1057 // Enables configuration. Requires store access. 1058 Windows.Foundation.IAsyncActionWithProgress<UInt32> EnsureConfigurationAvailableAsync(); 1059 } 1060 1061 // Top level entry point for configuration, enabling easier usage in out-of-process scenarios. 1062 [contract(Microsoft.Management.Configuration.Contract, 2)] 1063 interface IConfigurationStatics2 requires IConfigurationStatics 1064 { 1065 // Creates an empty configuration parameter. 1066 ConfigurationParameter CreateConfigurationParameter(); 1067 } 1068 1069 // Top level entry point for configuration, enabling easier usage in out-of-process scenarios. 1070 [contract(Microsoft.Management.Configuration.Contract, 4)] 1071 interface IConfigurationStatics3 requires IConfigurationStatics2 1072 { 1073 // Creates an empty configuration parameter. 1074 FindUnitProcessorsOptions CreateFindUnitProcessorsOptions(); 1075 } 1076 1077 // Top level entry point for configuration, enabling easier usage in out-of-process scenarios. 1078 [contract(Microsoft.Management.Configuration.Contract, 1)] 1079 runtimeclass ConfigurationStaticFunctions : [default]IConfigurationStatics, IConfigurationStatics2, IConfigurationStatics3 1080 { 1081 ConfigurationStaticFunctions(); 1082 } 1083 1084 /// Force midl3 to generate vector marshalling info. 1085 declare 1086 { 1087 // Due to the way that metadata (WinMD) based marshalling works, in order for any of these to be IIterable<T>, they need to be 1088 // included in the manifest of the package. Update the DumpProxyStubRegistrationsCommand to add any new types to make it easier 1089 // to iterate over these collections, especially in C#. 1090 interface Windows.Foundation.Collections.IVector<ConfigurationUnit>; 1091 interface Windows.Foundation.Collections.IVector<ConfigurationSet>; 1092 interface Windows.Foundation.Collections.IVector<ConfigurationConflict>; 1093 interface Windows.Foundation.Collections.IVectorView<IConfigurationUnitSettingDetails>; 1094 interface Windows.Foundation.Collections.IVectorView<ConfigurationConflictSetting>; 1095 interface Windows.Foundation.Collections.IVectorView<GetConfigurationUnitDetailsResult>; 1096 interface Windows.Foundation.Collections.IVectorView<ApplyConfigurationUnitResult>; 1097 interface Windows.Foundation.Collections.IVectorView<TestConfigurationUnitResult>; 1098 interface Windows.Foundation.Collections.IVectorView<ConfigurationSet>; 1099 interface Windows.Foundation.Collections.IVector<ConfigurationEnvironment>; 1100 interface Windows.Foundation.Collections.IVector<IConfigurationUnitProcessorDetails>; 1101 } 1102 1103 // Provides a way to centralize the distribution of interfaces relevant to specific implementations of IConfigurationSetProcessorFactory. 1104 namespace SetProcessorFactory 1105 { 1106 // The same as PowerShell ExecutionPolicy: 1107 // https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies 1108 enum PwshConfigurationProcessorPolicy 1109 { 1110 Unrestricted = 0, 1111 RemoteSigned = 1, 1112 AllSigned = 2, 1113 Restricted = 3, 1114 Bypass = 4, 1115 Undefined = 5, 1116 Default = RemoteSigned, 1117 }; 1118 1119 enum PwshConfigurationProcessorLocation 1120 { 1121 CurrentUser = 0, 1122 AllUsers = 1, 1123 WinGetModulePath = 2, 1124 Custom = 3, 1125 Default = WinGetModulePath, 1126 }; 1127 1128 // The properties provided by the "pwsh" processor factory. 1129 interface IPwshConfigurationSetProcessorFactoryProperties 1130 { 1131 // The module paths to add to the processor. 1132 // This will be in addition to any paths added by the processor and those inherent to PowerShell. 1133 Windows.Foundation.Collections.IVectorView<String> AdditionalModulePaths; 1134 1135 // The execution policy to apply; must be set before taking actions with the processor. 1136 PwshConfigurationProcessorPolicy Policy; 1137 1138 // The location to install modules. Default is WinGetModulePath 1139 PwshConfigurationProcessorLocation Location; 1140 1141 // The custom location. Only applicable for Scope.Custom 1142 String CustomLocation; 1143 }; 1144 } 1145 }