Skip to content

Commit

Permalink
Get-TssDistributedEngineConfiguration - new command to pull the confi…
Browse files Browse the repository at this point in the history
…guration details
  • Loading branch information
wsmelton committed Oct 5, 2021
1 parent fd5a14c commit 370cb33
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Get-TssDistributedEngineConfiguration

## SYNOPSIS
Get the configuration for Distributed Engine feature of Secret Server

## SYNTAX

```
Get-TssDistributedEngineConfiguration [-TssSession] <Session> [<CommonParameters>]
```

## DESCRIPTION
Get the configuration for Distributed Engine feature of Secret Server

## EXAMPLES

### EXAMPLE 1
```
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Get-TssDistributedEngineConfiguration -TssSession $session some test value
```

Return configuration of Distributed Engine feature in Secret Server

## PARAMETERS

### -TssSession
TssSession object created by New-TssSession for authentication

```yaml
Type: Session
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### Thycotic.PowerShell.DistributedEngines.Configuration
## NOTES
Requires TssSession object returned by New-TssSession
## RELATED LINKS
[https://thycotic-ps.github.io/thycotic.secretserver/commands/distributed-engines/Get-TssDistributedEngineConfiguration](https://thycotic-ps.github.io/thycotic.secretserver/commands/distributed-engines/Get-TssDistributedEngineConfiguration)
[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/distributed-engines/Get-TssDistributedEngineConfiguration.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/distributed-engines/Get-TssDistributedEngineConfiguration.ps1)
38 changes: 38 additions & 0 deletions src/Thycotic.SecretServer.Format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -3462,5 +3462,43 @@
</TableControl>
</View>

<!-- Thycotic.PowerShell.DistributedEngines.Configuration -->
<View>
<Name>DistributedEngines.Configuration</Name>
<ViewSelectedBy>
<TypeName>Thycotic.PowerShell.DistributedEngines.Configuration</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>EnableDistributedEngines</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Protocol</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>CallbackUrl</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>DefaultCallbackIntervalSeconds</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ResponseBusSiteConnectorId</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>

</ViewDefinitions>
</Configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.DistributedEngines
{
public class Configuration
{
public EngineAzServiceBusType AzureServiceBusTransportType { get; set; }
public int CallbackPort { get; set; }
public string CallbackUrl { get; set; }
public int DefaultCallbackIntervalSeconds { get; set; }
public bool EnableDistributedEngines { get; set; }
public EngineProtocol Protocol { get; set; }
public int ResponseBusSiteConnectorId { get; set; }
public int SecretHeartbeatMessageMinutesToLive { get; set; }
public int SecretHeartbeatMessageRetryMinutes { get; set; }
public int SecretPasswordChangeMessageMinutesToLive { get; set; }
public int SecretPasswordChangeMessageRetryMinutes { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Thycotic.PowerShell.Enums
{
public enum EngineAzServiceBusType
{
Amqp,
AmqpWebSockets
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Thycotic.PowerShell.Enums
{
public enum EngineProtocol
{
Http,
Https,
Tcp
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
function Get-TssDistributedEngineConfiguration {
<#
.SYNOPSIS
Get the configuration for Distributed Engine feature of Secret Server
.DESCRIPTION
Get the configuration for Distributed Engine feature of Secret Server
.EXAMPLE
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Get-TssDistributedEngineConfiguration -TssSession $session some test value
Return configuration of Distributed Engine feature in Secret Server
.LINK
https://thycotic-ps.github.io/thycotic.secretserver/commands/distributed-engines/Get-TssDistributedEngineConfiguration
.LINK
https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/distributed-engines/Get-TssDistributedEngineConfiguration.ps1
.NOTES
Requires TssSession object returned by New-TssSession
#>
[CmdletBinding()]
[OutputType('Thycotic.PowerShell.DistributedEngines.Configuration')]
param (
# TssSession object created by New-TssSession for authentication
[Parameter(Mandatory,ValueFromPipeline,Position = 0)]
[Thycotic.PowerShell.Authentication.Session]
$TssSession
)
begin {
$tssParams = $PSBoundParameters
$invokeParams = . $GetInvokeApiParams $TssSession
}
process {
Get-TssInvocation $PSCmdlet.MyInvocation
if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) {
Compare-TssVersion $TssSession '10.9.000064' $PSCmdlet.MyInvocation
$uri = $TssSession.ApiUrl, 'distributed-engine', 'configuration' -join '/'
$invokeParams.Uri = $uri
$invokeParams.Method = 'GET'

Write-Verbose "Performing the operation $($invokeParams.Method) $($invokeParams.Uri)"
try {
$apiResponse = Invoke-TssApi @invokeParams
$restResponse = . $ProcessResponse $apiResponse
} catch {
Write-Warning "Issue getting Distributed Engine configuration"
$err = $_
. $ErrorHandling $err
}

if ($restResponse) {
[Thycotic.PowerShell.DistributedEngines.Configuration]$restResponse
}
} else {
Write-Warning "No valid session found"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BeforeDiscovery {
$commandName = Split-Path ($PSCommandPath.Replace('.Tests.ps1','')) -Leaf
}
Describe "$commandName verify parameters" {
BeforeDiscovery {
[object[]]$knownParameters = 'TssSession'
[object[]]$currentParams = ([Management.Automation.CommandMetaData]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')).Parameters.Keys
[object[]]$commandDetails = [System.Management.Automation.CommandInfo]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')
$unknownParameters = Compare-Object -ReferenceObject $knownParameters -DifferenceObject $currentParams -PassThru
}
Context "Verify parameters" -Foreach @{currentParams = $currentParams } {
It "$commandName should contain <_> parameter" -TestCases $knownParameters {
$_ -in $currentParams | Should -Be $true
}
It "$commandName should not contain parameter: <_>" -TestCases $unknownParameters {
$_ | Should -BeNullOrEmpty
}
}
Context "Command specific details" {
It "$commandName should set OutputType to Thycotic.PowerShell.DistributedEngines.Configuration" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.DistributedEngines.Configuration'
}
}
}

0 comments on commit 370cb33

Please sign in to comment.