Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dan1el42/10e24dbe702befbb00e6cd9e57d74650 to your computer and use it in GitHub Desktop.
Save Dan1el42/10e24dbe702befbb00e6cd9e57d74650 to your computer and use it in GitHub Desktop.
[DscResource()]
class SampleResourceStandalone {
[DscProperty(Key)]
[string] $Name
# Gets the resource's current state.
[SampleResourceStandalone] Get() {
return $this
}
# Sets the desired state of the resource.
[void] Set() {
Invoke-SampleResourceHelper
}
# Tests if the resource is in the desired state.
[bool] Test() {
return $false
}
}
[DscResource()]
class SampleResourceCluster {
[DscProperty(Key)]
[string] $Name
# Gets the resource's current state.
[SampleResourceCluster] Get() {
return $this
}
# Sets the desired state of the resource.
[void] Set() {
Invoke-SampleResourceHelper
}
# Tests if the resource is in the desired state.
[bool] Test() {
return $false
}
}
function Invoke-SampleResourceHelper {
# Do work
Write-Verbose -Message 'Do work ...'
Start-Sleep -Seconds 20
Write-Verbose -Message '... done!'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment