Skip to content

Commit f19af9f

Browse files
(AB-506290) Standardize naming in article (#383)
Prior to this change, the _Authoring a class-based DSC Resource_ article inconsistently referred to `NewFile` and `MyDscResource` for the resource and module. This change: - Standardizes on using `NewFile` as the resource and module name. - Fixes AB#506290
1 parent 253e92c commit f19af9f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

dsc/docs-conceptual/dsc-2.0/how-tos/resources/authoring/class-based.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ For more information about DSC Resources, see [DSC Resources][1].
2525
## Folder structure for a class Resource
2626

2727
To implement a DSC Resource with a PowerShell class, create the following folder structure. The
28-
class is defined in `MyDscResource.psm1` and the module manifest is defined in `MyDscResource.psd1`.
28+
class is defined in `NewFile.psm1` and the module manifest is defined in `NewFile.psd1`.
2929

3030
```text
3131
$env:ProgramFiles\WindowsPowerShell\Modules (folder)
32-
|- MyDscResource (folder)
33-
MyDscResource.psm1
34-
MyDscResource.psd1
32+
|- NewFile (folder)
33+
NewFile.psm1
34+
NewFile.psd1
3535
```
3636

3737
## Create the class
@@ -61,7 +61,7 @@ follows.
6161
[string] $content
6262
6363
[DscProperty(NotConfigurable)]
64-
[MyDscResourceReason[]] $Reasons
64+
[NewFileReason[]] $Reasons
6565
```
6666

6767
Notice that the properties are modified by attributes. The meaning of the attributes is as follows:
@@ -90,7 +90,7 @@ If you would like to include a new type with defined properties that you can use
9090
DSC Resource, create a class with property types as described before.
9191

9292
```powershell
93-
class MyDscResourceReason {
93+
class NewFileReason {
9494
[DscProperty()]
9595
[string] $Code
9696
@@ -100,7 +100,7 @@ class MyDscResourceReason {
100100
```
101101

102102
> [!NOTE]
103-
> The `MyDscResourceReason` class is declared here with the module's name as a prefix. While you can
103+
> The `NewFileReason` class is declared here with the module's name as a prefix. While you can
104104
> give embedded classes any name, if two or more modules define a class with the same name and are
105105
> both used in a configuration, PowerShell raises an exception.
106106
>
@@ -134,10 +134,10 @@ function Get-File {
134134
[String]$content
135135
)
136136
137-
$fileContent = [MyDscResourceReason]::new()
137+
$fileContent = [NewFileReason]::new()
138138
$fileContent.code = 'file:file:content'
139139
140-
$filePresent = [MyDscResourceReason]::new()
140+
$filePresent = [NewFileReason]::new()
141141
$filePresent.code = 'file:file:path'
142142
143143
$ensureReturn = 'Absent'
@@ -309,7 +309,7 @@ enum ensure {
309309
errors raised when multiple modules with DSC Resources define the
310310
Reasons property for reporting when they're out-of-state.
311311
#>
312-
class MyDscResourceReason {
312+
class NewFileReason {
313313
[DscProperty()]
314314
[string] $Code
315315
@@ -332,10 +332,10 @@ function Get-File {
332332
[String]$content
333333
)
334334
335-
$fileContent = [MyDscResourceReason]::new()
335+
$fileContent = [NewFileReason]::new()
336336
$fileContent.code = 'file:file:content'
337337
338-
$filePresent = [MyDscResourceReason]::new()
338+
$filePresent = [NewFileReason]::new()
339339
$filePresent.code = 'file:file:path'
340340
341341
$ensureReturn = 'Absent'
@@ -502,7 +502,7 @@ class NewFile {
502502
about the Resource when it is present.
503503
#>
504504
[DscProperty(NotConfigurable)]
505-
[MyDscResourceReason[]] $Reasons
505+
[NewFileReason[]] $Reasons
506506
507507
<#
508508
This method is equivalent of the Get-TargetResource script function.
@@ -628,9 +628,9 @@ A module can define multiple class-based DSC Resources. You need to declare all
628628

629629
```text
630630
$env:ProgramFiles\PowerShell\Modules (folder)
631-
|- MyDscResource (folder)
632-
|- MyDscResource.psm1
633-
MyDscResource.psd1
631+
|- NewFile (folder)
632+
|- NewFile.psm1
633+
NewFile.psd1
634634
```
635635

636636
## See Also

0 commit comments

Comments
 (0)