Skip to content

Commit

Permalink
add mock implementation of validate for powershellgroup
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveL-MSFT committed Jan 17, 2024
1 parent 01819f1 commit d96b669
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions powershellgroup/powershellgroup.dsc.resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
"input": "stdin",
"return": "state"
},
"validate": {
"executable": "pwsh",
"args": [
"-NoLogo",
"-NonInteractive",
"-NoProfile",
"-Command",
"$Input | ./powershellgroup.resource.ps1 Validate"
]
},
"exitCodes": {
"0": "Success",
"1": "Error"
Expand Down
7 changes: 6 additions & 1 deletion powershellgroup/powershellgroup.resource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[CmdletBinding()]
param(
[ValidateSet('List','Get','Set','Test')]
[ValidateSet('List','Get','Set','Test','Validate')]
$Operation = 'List',
[Switch]
$WinPS = $false,
Expand Down Expand Up @@ -327,6 +327,11 @@ elseif ($Operation -eq 'Test')

$result | ConvertTo-Json
}
elseif ($Operation -eq 'Validate')
{
# TODO: this is placeholder
@{ valid = $true } | ConvertTo-Json
}
else
{
"ERROR: Unsupported operation requested from powershellgroup.resource.ps1"
Expand Down

0 comments on commit d96b669

Please sign in to comment.