-
Notifications
You must be signed in to change notification settings - Fork 47
Convert RDConnectionBrokerHAMode to class-based
#155
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
Open
dan-hughes
wants to merge
14
commits into
dsccommunity:main
Choose a base branch
from
dan-hughes:class/cbhamode
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.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dde0254
Remove script resource items
dan-hughes 4809771
Add class resource items
dan-hughes be6a03c
ModuleBuilder looks for AliasesToExport in manifest
dan-hughes 0500a96
Update changelog
dan-hughes 707b889
Add missing parameter description
dan-hughes 65cbcce
Add comment
dan-hughes 8393541
Use PSResourceGet
dan-hughes 4881fd4
Update issue
dan-hughes 7d0bc5d
Temporarily add Configuration until ModuleBuilder PSGallery is fixed
dan-hughes 78cffa7
Does stream 1 need to be hidden
dan-hughes 8813b44
Fix typo and missing justification
dan-hughes 0be3e20
Do not check the connection string
dan-hughes d6c91bb
Make RunAsCredential Optional
dan-hughes 99c1371
Ensure the properties are enforced, may need to normalise the order t…
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,157 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| The `RDConnectionBrokerHAMode` DSC resource is used to configure the Remote Desktop Connection Broker HA. | ||
|
|
||
| .DESCRIPTION | ||
| This resource is used to configure the Remote Desktop Connection Broker HA. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Target machine must be running Windows Server 2012 or later. | ||
|
|
||
| ## Known issues | ||
|
|
||
| All issues are not listed here, see [all open issues](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+RDConnectionBrokerHAMode). | ||
|
|
||
| .PARAMETER ClientAccessName | ||
| Specifies the Client Access Name for the RD Connection Broker HA deployment. | ||
|
|
||
| .PARAMETER DatabaseConnectionString | ||
| Specifies the primary database connection string for the RD Connection Broker HA deployment. | ||
|
|
||
| .PARAMETER DatabaseSecondaryConnectionString | ||
| Specifies the secondary database connection string for the RD Connection Broker HA deployment. | ||
|
|
||
| .PARAMETER DatabaseFilePath | ||
| Specifies the file path for the RD Connection Broker HA database. | ||
|
|
||
| .PARAMETER ConnectionBroker | ||
| Specifies the FQDN of a server to host the RD Connection Broker role service. | ||
|
|
||
| .PARAMETER ActiveManagementServer | ||
| Returns the FQDN of the server that is currently active for management tasks. | ||
|
|
||
| .PARAMETER Reasons | ||
| Returns the reason a property is not in desired state. | ||
| #> | ||
|
|
||
| [DscResource(RunAsCredential = 'Optional')] | ||
| class RDConnectionBrokerHAMode : ResourceBase | ||
| { | ||
| [DscProperty(Key)] | ||
| [ValidateLength(1, 256)] | ||
| [System.String] | ||
| $ClientAccessName | ||
|
|
||
| [DscProperty()] | ||
| [System.String] | ||
| $ConnectionBroker | ||
|
|
||
| [DscProperty(Mandatory)] | ||
| [System.String] | ||
| $DatabaseConnectionString | ||
|
|
||
| [DscProperty()] | ||
| [System.String] | ||
| $DatabaseSecondaryConnectionString | ||
|
|
||
| [DscProperty()] | ||
| [System.String] | ||
| $DatabaseFilePath | ||
|
|
||
| [DscProperty(NotConfigurable)] | ||
| [System.String] | ||
| $ActiveManagementServer | ||
|
|
||
| [DscProperty(NotConfigurable)] | ||
| [RDSReason[]] | ||
| $Reasons | ||
|
|
||
| RDConnectionBrokerHAMode () : base ($PSScriptRoot) | ||
| { | ||
| $this.ExcludeDscProperties = @( | ||
| 'ConnectionBroker' | ||
| ) | ||
| } | ||
|
|
||
| [RDConnectionBrokerHAMode] 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 Get() call this method to get the current state as a Hashtable. | ||
| hidden [System.Collections.Hashtable] GetCurrentState([System.Collections.Hashtable] $properties) | ||
| { | ||
| $getParameters = @{ | ||
| ConnectionBroker = $this.ConnectionBroker | ||
| ErrorAction = 'SilentlyContinue' | ||
| } | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($this.ConnectionBroker)) | ||
| { | ||
| $getParameters.ConnectionBroker = (Get-ComputerName -FullyQualifiedDomainName) | ||
| } | ||
|
|
||
| $currentStateResult = Get-RDConnectionBrokerHighAvailability @getParameters | ||
|
|
||
| return @{ | ||
| DatabaseConnectionString = $currentStateResult.DatabaseConnectionString | ||
| DatabaseSecondaryConnectionString = $currentStateResult.DatabaseSecondaryConnectionString | ||
| DatabaseFilePath = $currentStateResult.DatabaseFilePath | ||
| ActiveManagementServer = $currentStateResult.ActiveManagementServer | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| Base method Set() call this method with the properties that should be | ||
| enforced and that are not in desired state. | ||
| #> | ||
| hidden [void] Modify([System.Collections.Hashtable] $properties) | ||
| { | ||
| # If the ActiveManagementServer property is not empty, then the configuration is currently active and cannot be modified. | ||
| if (-not [string]::IsNullOrEmpty($this.ActiveManagementServer)) | ||
| { | ||
| New-InvalidOperationException -Message $this.localizedData.RDConnectionBrokerHAMode_ConfigurationCannotBeModified | ||
| } | ||
|
|
||
| $setParameters = @{ | ||
| ClientAccessName = $this.ClientAccessName | ||
| ConnectionBroker = $this.ConnectionBroker | ||
| } | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($this.ConnectionBroker)) | ||
| { | ||
| $setParameters.ConnectionBroker = (Get-ComputerName -FullyQualifiedDomainName) | ||
| } | ||
|
|
||
| Set-RDConnectionBrokerHighAvailability @setParameters @properties | ||
| } | ||
|
|
||
| <# | ||
| Base method Assert() call this method with the properties that was assigned | ||
| a value. | ||
| #> | ||
| hidden [void] AssertProperties([System.Collections.Hashtable] $properties) | ||
| { | ||
| if (-not (Test-RemoteDesktopServicesDscOsRequirement)) | ||
| { | ||
| New-InvalidOperationException -Message $this.localizedData.RDConnectionBrokerHAMode_OSRequirementNotMet | ||
| } | ||
|
|
||
| # Module Import in verbose mode outputs lots of data, so redirecting to null. | ||
| Import-RemoteDesktopModule 4> $null | ||
| } | ||
| } |
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
167 changes: 0 additions & 167 deletions
167
source/DSCResources/DSC_RDConnectionBrokerHAMode/DSC_RDConnectionBrokerHAMode.psm1
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
source/DSCResources/DSC_RDConnectionBrokerHAMode/DSC_RDConnectionBrokerHAMode.schema.mof
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...DSCResources/DSC_RDConnectionBrokerHAMode/en-US/DSC_RDConnectionBrokerHAMode.strings.psd1
This file was deleted.
Oops, something went wrong.
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.