Skip to content

Commit 31070a9

Browse files
author
Kapil Borle
committed
Update rule documentation
1 parent ba212ed commit 31070a9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

RuleDocumentation/UseIdenticalMandatoryParametersForDSC.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@
44

55
## Description
66

7-
The `Get-TargetResource`, `Test-TargetResource` and `Set-TargetResource` functions of DSC Resource must have the same mandatory parameters.
7+
For script based DSC resources the `Get-TargetResource`, `Test-TargetResource` and `Set-TargetResource` functions must have identical mandatory parameters that are also the keys in the corresponding `mof` file.
88

99
## How
1010

11-
Correct the mandatory parameters for the functions in DSC resource.
11+
Make sure all the keys have equivalent mandatory parameters in the `Get/Set/Test` functions.
1212

1313
## Example
14+
Consider the following `mof` file.
15+
```powershell
16+
class WaitForAny : OMI_BaseResource
17+
{
18+
[key, Description("Name of Resource on remote machine")]
19+
string Name;
20+
21+
[required, Description("List of remote machines")]
22+
string NodeName[];
23+
};
24+
```
1425

1526
### Wrong
1627

@@ -33,7 +44,7 @@ function Set-TargetResource
3344
(
3445
[parameter(Mandatory = $true)]
3546
[String]
36-
$TargetName
47+
$TargetName # this should be Name
3748
)
3849
...
3950
}

0 commit comments

Comments
 (0)