Enable passing JSON input properties as args to resource

Open
#1,475 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start by reviewing the resource manifest handling and expression evaluation entry points for set arguments. Define how input() resolves properties, how object results and secureString values are handled, and how get/export continue to require JSON output; the example manifest provides the expected behavior.

Written by the indexing model from the issue text.

Description

Issue-Enhancement Needs Triage
Summary of the new feature / enhancement

There might be an existing CLI tool or the developer wants their CLI tool to serve as both a user facing tool but also DSC resource. So in that case, they wouldn't want to receive and process a JSON payload.

Proposed technical implementation details (optional)

In the resource manifest, we can add support for expressions for the args:

{
    "$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
    "type": "Microsoft.Windows/User",
    "version": "1.0.0",
    "set": {
        "executable": "net.exe",
        "args": [
            "user",
            "[input().name]",
            "[input().password]",
            "/add"
        ]
    }
}

input() would be a new function that returned the values under properties. Normal dot-notation rules apply. Any functions that result in an object would be an error. secureString would resolve to plain-text.

For get and export, the tool would still be required to return JSON output and the manifest would specify something like:

"/output",
"json"
Dominant language
Rust
Stars
546
Forks
84
Avg merge
2d 9h
Merged PRs (30d)
25

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/DSC

All issues in PowerShell/DSC

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.