-
Notifications
You must be signed in to change notification settings - Fork 49
pass input metadata to resource #1069
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
base: main
Are you sure you want to change the base?
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 modifies the add_metadata()
function to pass input metadata from configuration resources to the actual resource invocations, enabling resources to access metadata during operations.
- Modified
add_metadata()
function to accept an optionalresource_metadata
parameter - For adapters, extend existing metadata with input metadata
- For resources, insert metadata as
_metadata
key in properties
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
dsc_lib/src/configure/mod.rs | Modified add_metadata() function signature and logic to handle resource metadata, updated all call sites to pass resource metadata |
dsc/tests/dsc_metadata.tests.ps1 | Added comprehensive tests for metadata passing across different operations (get, set, test, export) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
@SteveL-MSFT - looks like the key name is |
if let Some(resource_metadata) = resource_metadata { | ||
let other_metadata = resource_metadata.other; | ||
if let Some(mut properties) = properties { | ||
properties.insert("_metadata".to_string(), Value::Object(other_metadata)); |
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.
I think we need to check if the resource has a _metadata
property before we add it otherwise it will invalidate their schema. There should be a test added for this as well. In the case the resource doesn't handle _metadata
, then we don't send it.
PR Summary
add_metadata()
to insert_metadata
key intoproperties
for resources and extend existingmetadata
key for adaptersPR Context