-
Notifications
You must be signed in to change notification settings - Fork 7
New Resource WSManClientConfig #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dan-hughes
wants to merge
15
commits into
dsccommunity:main
Choose a base branch
from
dan-hughes:f/WSManClientConfig
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e4aae03
Use preview Test module
dan-hughes d616edc
Class resources are not modules anymore
dan-hughes b179574
Add resource WSManClientConfig
dan-hughes 9925b3e
Update changelog
dan-hughes 5fb6470
Update variable name
dan-hughes aea1f9f
Fix property type
dan-hughes bacd782
Add example
dan-hughes bcbaf51
Wait for LCM in WSManConfig
dan-hughes 6350dd1
Add string array functionality
dan-hughes 412547b
Update for string array
dan-hughes 8985d10
Fix default value
dan-hughes bbdeaee
Test fix
dan-hughes 3bece4e
Fix for string array
dan-hughes d2ec3f7
Add newline
dan-hughes 7a089ac
Use DR.Test latest
dan-hughes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,131 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| The `WSManClientConfig` DSC resource is used to configure WS-Man client specific settings. | ||
|
|
||
| .DESCRIPTION | ||
| This resource is used configure WS-Man Client settings. | ||
|
|
||
|
dan-hughes marked this conversation as resolved.
|
||
| .PARAMETER NetworkDelayms | ||
| Specifies the extra time in milliseconds that the client computer waits to accommodate for network delay time. | ||
|
|
||
| .PARAMETER URLPrefix | ||
| Specifies a URL prefix on which to accept HTTP or HTTPS requests. The default URL prefix is wsman. | ||
|
|
||
| .PARAMETER AllowUnencrypted | ||
| Allows the client computer to request unencrypted traffic. | ||
|
|
||
| .PARAMETER TrustedHosts | ||
| Specifies the list of remote computers that are trusted. | ||
|
|
||
| .PARAMETER AuthBasic | ||
| Allows the WinRM client to use Basic authentication. | ||
|
|
||
| .PARAMETER AuthDigest | ||
| Allows the WinRM client to use Digest authentication. | ||
|
|
||
| .PARAMETER AuthCertificate | ||
| Allows the WinRM client to use client certificate-based authentication. | ||
|
|
||
| .PARAMETER AuthKerberos | ||
| Allows the WinRM client to use Kerberos authentication. | ||
|
|
||
| .PARAMETER AuthNegotiate | ||
| Allows the WinRM client to use Negotiate authentication. | ||
|
|
||
| .PARAMETER AuthCredSSP | ||
| Allows the WinRM client to use Credential Security Support Provider (CredSSP) authentication. | ||
| #> | ||
|
|
||
| [DscResource()] | ||
| class WSManClientConfig : WSManConfigBase | ||
| { | ||
| [DscProperty()] | ||
| [Nullable[System.UInt32]] | ||
| $NetworkDelayms | ||
|
|
||
| [DscProperty()] | ||
| [System.String] | ||
| $URLPrefix | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AllowUnencrypted | ||
|
|
||
| [DscProperty()] | ||
| [System.String[]] | ||
| $TrustedHosts | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthBasic | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthDigest | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthCertificate | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthKerberos | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthNegotiate | ||
|
|
||
| [DscProperty()] | ||
| [Nullable[System.Boolean]] | ||
| $AuthCredSSP | ||
|
|
||
| WSManClientConfig () : base () | ||
| { | ||
| $this.ResourceURI = 'localhost\Client' | ||
| $this.HasAuthContainer = $true | ||
| } | ||
|
dan-hughes marked this conversation as resolved.
|
||
|
|
||
| [WSManClientConfig] Get() | ||
| { | ||
| # Call the base method to return the properties. | ||
| return ([ResourceBase] $this).Get() | ||
| } | ||
|
|
||
| [void] Set() | ||
| { | ||
| # Call the base method to enforce the properties. | ||
| ([ResourceBase] $this).Set() | ||
| } | ||
|
|
||
| [System.Boolean] Test() | ||
| { | ||
| # Call the base method to test all of the properties that should be enforced. | ||
| return ([ResourceBase] $this).Test() | ||
| } | ||
|
|
||
| <# | ||
| Base method Assert() call this method with the properties that was assigned | ||
| a value. | ||
| #> | ||
| hidden [void] AssertProperties([System.Collections.Hashtable] $properties) | ||
| { | ||
| $assertBoundParameterParameters = @{ | ||
| BoundParameterList = $properties | ||
| RequiredParameter = @( | ||
| 'NetworkDelayms' | ||
| 'URLPrefix' | ||
| 'AllowUnencrypted' | ||
| 'TrustedHosts' | ||
| 'AuthBasic' | ||
| 'AuthDigest' | ||
| 'AuthCertificate' | ||
| 'AuthKerberos' | ||
| 'AuthNegotiate' | ||
| 'AuthCredSSP' | ||
| ) | ||
| RequiredBehavior = 'Any' | ||
| } | ||
|
|
||
| Assert-BoundParameter @assertBoundParameterParameters | ||
| } | ||
| } | ||
40 changes: 40 additions & 0 deletions
40
source/Examples/Resources/WSManClientConfig/1-WSManClientConfig_Config.ps1
This file contains hidden or 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,40 @@ | ||
| <#PSScriptInfo | ||
| .VERSION 1.0.0 | ||
| .GUID 5eb95759-9a02-4121-bfca-bba124bfc4f8 | ||
| .AUTHOR DSC Community | ||
| .COMPANYNAME DSC Community | ||
| .COPYRIGHT Copyright the DSC Community contributors. All rights reserved. | ||
| .TAGS DSCConfiguration | ||
| .LICENSEURI https://github.com/dsccommunity/WSManDsc/blob/main/LICENSE | ||
| .PROJECTURI https://github.com/dsccommunity/WSManDsc | ||
| .ICONURI | ||
| .EXTERNALMODULEDEPENDENCIES | ||
| .REQUIREDSCRIPTS | ||
| .EXTERNALSCRIPTDEPENDENCIES | ||
| .RELEASENOTES First version. | ||
| .PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core | ||
| #> | ||
|
|
||
| #Requires -module WSManDsc | ||
|
|
||
| <# | ||
| .DESCRIPTION | ||
| Set the WS-Man client to disallow unencrypted traffic, | ||
| disable Basic authentication and set TrustedHosts to '*'. | ||
| #> | ||
|
dan-hughes marked this conversation as resolved.
|
||
| Configuration WSManClientConfig_Config | ||
| { | ||
| Import-DscResource -Module WSManDsc | ||
|
|
||
| Node localhost | ||
| { | ||
| WSManClientConfig ClientConfig | ||
| { | ||
| IsSingleInstance = 'Yes' | ||
| AllowUnencrypted = $false | ||
| AuthBasic = $false | ||
| TrustedHosts = '*' | ||
|
|
||
| } # End of WSManClientConfig Resource | ||
| } # End of Node | ||
| } # End of Configuration | ||
This file contains hidden or 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,14 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| The localized resource strings in English (en-US) for the | ||
| resource WSManClientConfig. This file should only contain | ||
| localized strings for private functions, public command, and | ||
| classes (that are not a DSC resource). | ||
| #> | ||
|
|
||
| ConvertFrom-StringData @' | ||
| ## Strings overrides for the ResourceBase's default strings. | ||
| # None | ||
|
|
||
| ## Strings directly used by the derived class WSManClientConfig. | ||
| '@ |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap the new changelog entry to 80 chars.
Line 18 exceeds the 80-character guideline; wrap the link to the next line with a 2‑space indent.
💡 Suggested wrap
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
80 chars is an old limit, I believe it's something like 120 chars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dan-hughes, according to the coding guidelines for this repository, there are different line length limits for different file types:**/*.md): Wrap lines at word boundaries when over 80 characters (except tables/code blocks)**/*.{ps1,psm1,psd1}): Limit lines to 120 charactersSince
CHANGELOG.mdis a Markdown file, the 80-character limit applies per the guidelines. The 120-character limit you're thinking of is specifically for PowerShell code files.That said, if you prefer to keep the current formatting, that's your call as the maintainer! I'm just following the repository's documented guidelines.
🧠 Learnings used