Skip to content

Instantly share code, notes, and snippets.

@bgelens
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgelens/389265585e896cdc4f4c to your computer and use it in GitHub Desktop.
Save bgelens/389265585e896cdc4f4c to your computer and use it in GitHub Desktop.
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