Skip to content

Commit

Permalink
Get-TssConfigurationSecretIndexer - new command
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Aug 23, 2021
1 parent af22ef6 commit 7e47c36
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 10 deletions.
58 changes: 58 additions & 0 deletions docs/commands/configurations/Get-TssConfigurationSecretIndexer.md
@@ -0,0 +1,58 @@
# Get-TssConfigurationSecretIndexer

## SYNOPSIS
Get Secret Indexer configuration

## SYNTAX

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

## DESCRIPTION
Get Secret Indexer configuration

## EXAMPLES

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

Return configuration of the Secret Search Indexer

## 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.Configuration.SearchIndexer
## NOTES
Requires TssSession object returned by New-TssSession

## RELATED LINKS

[https://thycotic-ps.github.io/thycotic.secretserver/commands/configuration/Get-TssConfigurationSecretIndexer](https://thycotic-ps.github.io/thycotic.secretserver/commands/configuration/Get-TssConfigurationSecretIndexer)

[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/configuration/Get-TssConfigurationSecretIndexer.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/configuration/Get-TssConfigurationSecretIndexer.ps1)

21 changes: 11 additions & 10 deletions src/Thycotic.SecretServer.psd1
Expand Up @@ -82,16 +82,17 @@ FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Find-TssUser', 'Get-TssConfiguration',
'Get-TssConfigurationLocalUserPassword',
'Get-TssConfigurationLogin', 'Get-TssConfigurationRpc',
'Get-TssConfigurationSaml', 'Get-TssConfigurationSecurity',
'Get-TssConfigurationSiteConnector', 'Get-TssEventPipeline',
'Get-TssEventPipelinePolicy', 'Get-TssEventPipelinePolicyActivity',
'Get-TssEventPipelineRun', 'Get-TssFolder', 'Get-TssFolderAudit',
'Get-TssFolderPermission', 'Get-TssFolderState', 'Get-TssGroup',
'Get-TssGroupMember', 'Get-TssGroupRole', 'Get-TssGroupUser',
'Get-TssMetadataField', 'Get-TssReport', 'Get-TssReportCategory',
'Get-TssReportParameter', 'Get-TssReportSchedule',
'Get-TssRpcAssociatedSecret', 'Get-TssRpcPasswordType',
'Get-TssScript', 'Get-TssSecret', 'Get-TssSecretAccessRequestOption',
'Get-TssConfigurationSaml', 'Get-TssConfigurationSecretIndexer',
'Get-TssConfigurationSecurity', 'Get-TssConfigurationSiteConnector',
'Get-TssEventPipeline', 'Get-TssEventPipelinePolicy',
'Get-TssEventPipelinePolicyActivity', 'Get-TssEventPipelineRun',
'Get-TssFolder', 'Get-TssFolderAudit', 'Get-TssFolderPermission',
'Get-TssFolderState', 'Get-TssGroup', 'Get-TssGroupMember',
'Get-TssGroupRole', 'Get-TssGroupUser', 'Get-TssMetadataField',
'Get-TssReport', 'Get-TssReportCategory', 'Get-TssReportParameter',
'Get-TssReportSchedule', 'Get-TssRpcAssociatedSecret',
'Get-TssRpcPasswordType', 'Get-TssScript', 'Get-TssSecret',
'Get-TssSecretAccessRequestOption',
'Get-TssSecretAccessRequestSecret', 'Get-TssSecretAttachment',
'Get-TssSecretAudit', 'Get-TssSecretDependency',
'Get-TssSecretDependencyGroup', 'Get-TssSecretDependencyRunStatus',
Expand Down
20 changes: 20 additions & 0 deletions src/Thycotic.SecretServer/classes/configurations/SearchIndexer.cs
@@ -0,0 +1,20 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.Configuration
{
public class SearchIndexer
{
public int DaysToKeepLogs { get; set; }
public bool Enabled { get; set; }
public string[] IndexingSeparators { get; set; }
public SearchIndexMode IndexMode { get; set; }
public float IndexPercentComplete { get; set; }
public DateTime? LastIndexDate { get; set; }
public bool LogAvailable { get; set; }
public SearchIndexStatus Status { get; set; }
}
}
13 changes: 13 additions & 0 deletions src/Thycotic.SecretServer/enums/configurations/SearchIndexMode.cs
@@ -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 SearchIndexMode
{
Standard,
Extended
}
}
@@ -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 SearchIndexStatus
{
NotStarted,
Idle,
Indexing
}
}
61 changes: 61 additions & 0 deletions src/functions/configurations/Get-TssConfigurationSecretIndexer.ps1
@@ -0,0 +1,61 @@
function Get-TssConfigurationSecretIndexer {
<#
.SYNOPSIS
Get Secret Indexer configuration
.DESCRIPTION
Get Secret Indexer configuration
.EXAMPLE
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Get-TssConfigurationIndexer -TssSession $session - some test value
Return configuration of the Secret Search Indexer
.LINK
https://thycotic-ps.github.io/thycotic.secretserver/commands/configuration/Get-TssConfigurationSecretIndexer
.LINK
https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/configuration/Get-TssConfigurationSecretIndexer.ps1
.NOTES
Requires TssSession object returned by New-TssSession
#>
[CmdletBinding()]
[OutputType('Thycotic.PowerShell.Configuration.SearchIndexer')]
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 {
Write-Verbose "Provided command parameters: $(. $GetInvocation $PSCmdlet.MyInvocation)"
if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) {
. $CheckVersion $TssSession '10.9.000064' $PSCmdlet.MyInvocation
$uri = $TssSession.ApiUrl, 'configuration', 'secret-search-indexer' -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 Search Indexer configuration"
$err = $_
. $ErrorHandling $err
}

if ($restResponse) {
[Thycotic.PowerShell.Configuration.SearchIndexer]$restResponse
}
} else {
Write-Warning "No valid session found"
}
}
}
24 changes: 24 additions & 0 deletions tests/configurations/Get-TssConfigurationSecretIndexer.Tests.ps1
@@ -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.Configuration.SearchIndexer" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.Configuration.SearchIndexer'
}
}
}

0 comments on commit 7e47c36

Please sign in to comment.