-
Notifications
You must be signed in to change notification settings - Fork 52
Add new inputKind for adapters to work against single resource instead of config #1124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new adapter functionality that allows adapters to work against single resources instead of requiring full configuration objects. The primary change replaces the config
property with inputKind
in adapter manifests, supporting both "full" (original behavior) and "single" (new capability) modes, with backwards compatibility maintained through aliasing.
Key changes:
- Introduces
AdapterInputKind
enum withFull
andSingle
variants to replace the previousConfigKind
- Adds
ResourceType
argument kind to pass target resource type information to adapters - Implements helper functions to handle both adapter invocation modes
- Creates a test adapter in
dsctest
tool to demonstrate the new functionality
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
tools/test_group_resource/src/main.rs | Adds target_resource field initialization for resource definitions |
tools/dsctest/src/main.rs | Adds adapter subcommand handling and schema support |
tools/dsctest/src/args.rs | Defines CLI arguments for adapter operations and resource types |
tools/dsctest/src/adapter.rs | Implements test adapter with single resource support |
tools/dsctest/resourceadapter.dsc.resource.json | Manifest for test adapter using new inputKind: "single" format |
dsc_lib/src/extensions/discover.rs | Updates process_args call to include resource type parameter |
dsc_lib/src/dscresources/resource_manifest.rs | Replaces ConfigKind with AdapterInputKind and adds ResourceType argument |
dsc_lib/src/dscresources/dscresource.rs | Adds adapter helper methods and target resource support |
dsc_lib/src/dscresources/command_resource.rs | Updates all invoke functions to accept target resource parameter |
dsc_lib/src/configure/mod.rs | Adds discovery access method and adapter input kind checking |
dsc_lib/locales/en-us.toml | Adds new localization strings for adapter error messages |
dsc/tests/dsc_adapter.tests.ps1 | Comprehensive test suite for adapter functionality |
.vscode/launch.json | Adds macOS debugging configuration with pretty printer |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dedf403
to
32ddc7a
Compare
PR Summary
config
property withinadapter
section of resource manifest is renamed toinputKind
which acceptsfull
(meaning config) orsingle
(meaning just a single resource). However,config
is an allowed alias for backwards compat.single
forinputKind
, but also for the args, there's a new object:where this arg object will use the value of
resourceTypeArg
as the parameter nae and supply the target resource type for the adapter as the parameter value.launch.json
change only applies to macOS and leverages an OSS script to pretty print variables in VSCode under debugging instead of showing the memory addressget
,set
,test
,delete
, andexport
for adapters got moved to help functions which handlesfull
orsingle
adapter invocationprocess_args()
needs the target resource type to fill in the parameter value, some plumbing was added in the existing functions to ensure this gets passed throughinputKind
dsctest
which doesn't adapt anything but holds the resources internallyPR Context
Fix #931