Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"keepachangelog",
"notin",
"pscmdlet",
"steppable"
"steppable",
"Serverv",
"Dhcpv"
],
"cSpell.ignorePaths": [
".git"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Unit tests for `DhcpServerDsc.OptionValueHelper`
- Unit tests for `DSC_xDhcpServerReservation`
- Resource `DhcpServerv4DnsDynamicUpdates`. Fixes [#65](https://github.com/dsccommunity/DhcpServerDsc/issues/65)

## [4.0.0] - 2025-01-20

Expand Down
8 changes: 7 additions & 1 deletion RequiredModules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@

# Build dependent modules
'DscResource.Common' = 'latest'
'DscResource.Base' = 'latest'

# Analyzer rules
'DscResource.AnalyzerRules' = 'latest'
'Indented.ScriptAnalyzerRules' = 'latest'

# Prerequisite modules for documentation.
'DscResource.DocGenerator' = 'latest'
'DscResource.DocGenerator' = @{
Version = 'latest'
Parameters = @{
AllowPrerelease = $true
}
}
PlatyPS = 'latest'
}
11 changes: 10 additions & 1 deletion build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
CopyPaths:
- en-US
- DSCResources
- Modules
Prefix: prefix.ps1
Encoding: UTF8
VersionedOutputDirectory: true
BuiltModuleSubdirectory: builtModule
Expand All @@ -20,6 +22,11 @@ NestedModule:
Path: ./output/RequiredModules/DscResource.Common
AddToManifest: false
Exclude: PSGetModuleInfo.xml
DscResource.Base:
CopyOnly: true
Path: ./output/RequiredModules/DscResource.Base
AddToManifest: false
Exclude: PSGetModuleInfo.xml
DhcpServerDsc.Common:
Prefix: prefix.ps1
VersionedOutputDirectory: false
Expand Down Expand Up @@ -102,6 +109,7 @@ Pester:
OutputEncoding: ascii
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
- Modules/DscResource.Base

CodeCoverage:
CodeCoverageMergedOutputFile: CodeCov_Merged.xml
Expand All @@ -112,7 +120,7 @@ DscTest:
Configuration:
Filter:
ExcludeTag:
- "Common Tests - New Error-Level Script Analyzer Rules"
- 'Common Tests - New Error-Level Script Analyzer Rules'
Output:
Verbosity: Detailed
CIFormat: Auto
Expand All @@ -126,6 +134,7 @@ DscTest:
- output
ExcludeModuleFile:
- Modules/DscResource.Common
- Modules/DscResource.Base
# Must exclude built module file because it should not be tested like MOF-based resources
- DhcpServerDsc.psm1
MainGitBranch: main
Expand Down
21 changes: 21 additions & 0 deletions source/Classes/001.DhcpServerReason.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<#
.SYNOPSIS
The reason a property of a DSC resource is not in desired state.

.DESCRIPTION
A DSC resource can have a read-only property `Reasons` that the compliance
part (audit via Azure Policy) of Azure AutoManage Machine Configuration
uses. The property Reasons holds an array of DhcpServerReason. Each DhcpServerReason
explains why a property of a DSC resource is not in desired state.
#>

class DhcpServerReason
{
[DscProperty()]
[System.String]
$Code

[DscProperty()]
[System.String]
$Phrase
}
42 changes: 42 additions & 0 deletions source/Classes/010.DhcpServerDnsDynamicUpdatesBase.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<#
.SYNOPSIS
A class with DSC properties that are used in multiple child classes.

.DESCRIPTION
A class with DSC properties that are used in multiple child classes.

.PARAMETER Reasons
Returns the reason a property is not in desired state.
#>

class DhcpServerDnsDynamicUpdatesBase : ResourceBase
{
[DscProperty(Mandatory)]
[Ensure]
$Ensure = [Ensure]::Present

[DscProperty()]
[System.Nullable[System.Boolean]]
$NameProtection

[DscProperty()]
[System.Nullable[System.Boolean]]
$DeleteDnsRROnLeaseExpiry

[DscProperty()]
[DynamicUpdatesType]
$DynamicUpdates

[DscProperty()]
[System.String]
$IPAddress

[DscProperty(NotConfigurable)]
[DhcpServerReason[]]
$Reasons

DhcpServerDnsDynamicUpdatesBase () : base ($PSScriptRoot)
{
$this.FeatureOptionalEnums = $true
}
}
Loading