Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DSC Class Resource Template.
enum Ensure
{
Absent
Present
}
enum List
{
First = 1
Second = 2
Last = 999
}
[DscResource()]
class Template
{
[DscProperty(Key)]
[String] $Name
[DscProperty(Mandatory)]
[Ensure] $Ensure
[DscProperty(NotConfigurable)]
[String] $Info
[DscProperty()]
[List] $List
[Template] Get()
{
return @{
}
}
[Bool] Test()
{
return $true
}
[Void] Set()
{
}
#Helper method to get the value from the enum
[Int]SettingToValue([String] $Setting) {
return ([List]::$Setting).value__
}
#Helper method to get the key from the enum
[String]ValueToSetting([int] $Value) {
return [List].GetEnumName($Value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.