Skip to content
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

Enable direct invocation of PS resource #79

Closed
SteveL-MSFT opened this issue May 17, 2023 · 3 comments · Fixed by #82
Closed

Enable direct invocation of PS resource #79

SteveL-MSFT opened this issue May 17, 2023 · 3 comments · Fixed by #82
Labels
Issue-Enhancement The issue is a feature or idea

Comments

@SteveL-MSFT
Copy link
Member

Summary of the new feature / enhancement

Enable dsc resource get -r <psresource> to invoke get, set, and test to a PS resource

Proposed technical implementation details (optional)

No response

@SteveL-MSFT SteveL-MSFT added the Issue-Enhancement The issue is a feature or idea label May 17, 2023
@mgreenegit
Copy link
Member

This is parity with invoke-dscresource, correct? In native command, what is the best option for input of property:value pairs? Do we still input a hashtable?

@michaeltlombardi
Copy link
Collaborator

@mgreenegit I would expect this to work like dsc resource (get|set|test) -r <command_resource> - you pass a JSON blob over stdin with the property bag.

In a super fancy ideal world that I think is explicitly out of scope for now, it would be very neat if DSC could lookup the resource specified by -r <name> and dynamically provide CLI flags for the properties. But for now, I think JSON over stdin is the sensible option and doesn't require any new engineering.

This would also mean you could do something like:

@{
  Scope = 'Machine'
  Ensure = 'Present'
  UpdateAutomatically = $true
  UpdateFrequency     = 45
} | ConvertTo-Json | dsc resource get -r TSToy.Example/PSTSToy

With is arguably as or more convenient than:

$Params = @{
  Module     = 'TSToy.Example'
  Name       = 'PSTSToy'
  Method     = 'Get'
  Properties = @{
    Scope               = 'Machine'
    Ensure              = 'Present'
    UpdateAutomatically = $true
    UpdateFrequency     = 45
  }
}
Invoke-DscResource @Params

@anmenaga
Copy link
Collaborator

This is implemented in #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement The issue is a feature or idea
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants