This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files to DscResource.Template (#388)
- Update DscResource.Template - Update README.md - Add module manifest (issue #67)
- Loading branch information
Showing
13 changed files
with
268 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
"Common Tests - Validate Markdown Files", | ||
"Common Tests - Validate Example Files", | ||
"Common Tests - Validate Module Files", | ||
"Common Tests - Validate Script Files", | ||
"Common Tests - Required Script Analyzer Rules", | ||
"Common Tests - Flagged Script Analyzer Rules", | ||
"Common Tests - New Error-Level Script Analyzer Rules", | ||
"Common Tests - Custom Script Analyzer Rules" | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
codecov: | ||
notify: | ||
require_ci_to_pass: no | ||
|
||
comment: | ||
layout: "reach, diff" | ||
behavior: default | ||
|
||
coverage: | ||
range: 50..80 | ||
round: down | ||
precision: 0 | ||
|
||
status: | ||
project: | ||
default: | ||
# Set the overall project code coverage requirement to 70% | ||
target: 70 | ||
patch: | ||
default: | ||
# Set the pull request requirement to not regress overall coverage by more than 5% | ||
# and let codecov.io set the goal for the code changed in the patch. | ||
target: auto | ||
threshold: 5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"powershell.codeFormatting.openBraceOnSameLine": false, | ||
"powershell.codeFormatting.newLineAfterOpenBrace": false, | ||
"powershell.codeFormatting.newLineAfterCloseBrace": true, | ||
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true, | ||
"powershell.codeFormatting.whitespaceBeforeOpenParen": true, | ||
"powershell.codeFormatting.whitespaceAroundOperator": true, | ||
"powershell.codeFormatting.whitespaceAfterSeparator": true, | ||
"powershell.codeFormatting.ignoreOneLineBlock": false, | ||
"powershell.codeFormatting.preset": "Custom", | ||
"files.trimTrailingWhitespace": true, | ||
"files.insertFinalNewline": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Change log for ResourceModuleDsc | ||
|
||
## Unreleased | ||
|
||
- Changes to ResourceName | ||
- Text describing what was changed and why, and a reference to any issues it | ||
closes ([issue #11111](https://github.com/PowerShell/SqlServerDsc/issues/11111)). | ||
[Name/Alias (@github_account)](https://github.com/github_account) |
99 changes: 99 additions & 0 deletions
99
DscResource.Template/DSCResources/MSFT_ResourceName/MSFT_ResourceName.psm1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<# | ||
.SYNOPSIS | ||
Returns ... | ||
.PARAMETER MandatoryParameter | ||
This ... | ||
#> | ||
function Get-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Collections.Hashtable])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$MandatoryParameter | ||
) | ||
|
||
# TODO: Code that returns the current state. | ||
|
||
return @{ | ||
Ensure = $ensure | ||
MandatoryParameter = $value1 | ||
NonMandatoryParameter = $value2 | ||
} | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Sets ... | ||
.PARAMETER MandatoryParameter | ||
This ... | ||
.PARAMETER NonMandatoryParameter | ||
This ... | ||
#> | ||
function Set-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$MandatoryParameter, | ||
|
||
[Parameter()] | ||
[System.String] | ||
$Ensure = 'Present', | ||
|
||
[Parameter()] | ||
[System.String] | ||
$NonMandatoryParameter | ||
) | ||
|
||
# Code that sets the desired state if evaluated to not in desired state. | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Determines if ... | ||
.PARAMETER MandatoryParameter | ||
This ... | ||
.PARAMETER NonMandatoryParameter | ||
This ... | ||
#> | ||
function Test-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Boolean])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$MandatoryParameter, | ||
|
||
[Parameter()] | ||
[System.String] | ||
$Ensure = 'Present', | ||
|
||
[Parameter()] | ||
[System.String] | ||
$NonMandatoryParameter | ||
) | ||
|
||
$testTargetResourceResult = $false | ||
|
||
$getTargetResourceParameters = @{ | ||
MandatoryParameter = $MandatoryParameter | ||
} | ||
|
||
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters | ||
|
||
# Code that tests the desired state. | ||
|
||
return $testTargetResourceResult | ||
} |
7 changes: 7 additions & 0 deletions
7
DscResource.Template/DSCResources/MSFT_ResourceName/MSFT_ResourceName.schema.mof
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ClassVersion("1.0.0.0"), FriendlyName("ResourceName")] | ||
class MSFT_ResourceName : OMI_BaseResource | ||
{ | ||
[Key, Description("Descriptive text for this property")] String MandatoryParameter; | ||
[Write, Description("Descriptive text for this property")] String NonMandatoryParameter; | ||
[Write, Description("Specifies if the ... should be present or absent. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; | ||
}; |
18 changes: 18 additions & 0 deletions
18
DscResource.Template/Examples/Resources/ResourceName/1-VeryShortDescription.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<# | ||
.EXAMPLE | ||
This example shows how to ... | ||
#> | ||
|
||
Configuration Example | ||
{ | ||
Import-DscResource -ModuleName <ResourceModule> | ||
|
||
Node $AllNodes.NodeName | ||
{ | ||
ResourceName ShortNameForResource | ||
{ | ||
Ensure = 'Present' | ||
MandatoryParameter = 'MyValue' | ||
NonMandatoryParameter = 'OtherValue' | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@{ | ||
# Version number of this module. | ||
moduleVersion = '1.0.0.0' | ||
|
||
# ID used to uniquely identify this module. | ||
GUID = '4776d156-201c-4103-a50e-cae240f6b1a1' | ||
|
||
# Author of this module | ||
Author = 'Microsoft Corporation' | ||
|
||
# Company or vendor of this module | ||
CompanyName = 'Microsoft Corporation' | ||
|
||
# Copyright statement for this module | ||
Copyright = '(c) 2018 Microsoft Corporation. All rights reserved.' | ||
|
||
# Description of the functionality provided by this module | ||
Description = 'Description of <ResourceModule>.' | ||
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
PowerShellVersion = '4.0' | ||
|
||
# Minimum version of the common language runtime (CLR) required by this module | ||
CLRVersion = '4.0' | ||
|
||
# Functions to export from this module | ||
FunctionsToExport = '*' | ||
|
||
# Cmdlets to export from this module | ||
CmdletsToExport = '*' | ||
|
||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
PrivateData = @{ | ||
|
||
PSData = @{ | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResource') | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://github.com/path_to_repository/blob/master/LICENSE' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/path_to_repository' | ||
|
||
# ReleaseNotes of this module | ||
ReleaseNotes = '' | ||
|
||
} # End of PSData hashtable | ||
|
||
} # End of PrivateData hashtable | ||
} |
5 changes: 5 additions & 0 deletions
5
DscResource.Template/Tests/Integration/MSFT_ResourceName.Integration.Tests.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<# | ||
.NOTES | ||
Please see the integration test configuration template | ||
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/integration_template.ps1 | ||
#> |
5 changes: 5 additions & 0 deletions
5
DscResource.Template/Tests/Integration/MSFT_ResourceName.config.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<# | ||
.NOTES | ||
Please see the integration test configuration template | ||
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/integration_template.config.ps1 | ||
#> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<# | ||
.NOTES | ||
Please see the integration test configuration template | ||
https://github.com/PowerShell/DscResources/blob/master/Tests.Template/unit_template.ps1 | ||
#> |
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