Last active
August 29, 2015 14:18
-
-
Save bgelens/389265585e896cdc4f4c to your computer and use it in GitHub Desktop.
DSC Class Resource Template.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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