New subcommand to return resources used in a config and if they exist
Summary of the new feature / enhancement
Higher level tools want to help the user install resources that are needed if they don't exist (bootstrapping). It would be useful to have a new subcommand to dsc that simply returns this information since the engine already does this but at runtime.
Proposed technical implementation details (optional)
dsc config analyze resources
We can extend other analyze subcommands in the future as needed.
What would the structure of the return data be?
Something like this:
resources:
- type: Foo/Bar # Fully qualified type name
version: 1.2.3 # Latest available
path: .../bar.dsc.resource.json # Path to manifest
# etc
- type: Foo.Bar/Baz # Fully qualified type name
available: false # Indicate the resource wasn't found
Or:
resources:
available:
- type: Foo/Bar
# etc
unavailable:
- type: Foo.Bar/Baz
Or something else?
Specifically wondering if we should indicate where in the configuration document each resource is used, whether it was defined with a version pin, and so on - in addition to the metadata about discovered resources we may want to return.
Depends on what the higher level tools need and will do with the information. Since this output structure is custom and doesn't have to match what is in the config, we could return the resolveVersion along with the original apiVersion which could indicate a range, for example.
Is this the same as https://github.com/PowerShell/DSC/issues/974?
@tgauth looks like a dupe, but since this has more recent discussion, resolving the older one as dupe
WinGet needs the properties (specifically for WinGet/Package) to determine if the installed package would bring the resources that aren't currently there. Properties that are expressions that can be statically resolved would return the value, but expressions using functions that require actual execution won't work and will return null explicitly.