From 5f3b0468b7e4f06c68f4eaa7b6cced75de517517 Mon Sep 17 00:00:00 2001 From: Shawn Melton <11204251+wsmelton@users.noreply.github.com> Date: Mon, 2 Aug 2021 17:26:34 -0500 Subject: [PATCH] Search-TssEventPipeline - switched endpoint to summaries --- .../event-pipeline/Search-TssEventPipeline.md | 2 +- src/Thycotic.SecretServer.Format.ps1xml | 47 +++++++++ src/Thycotic.SecretServer.Types.ps1xml | 9 ++ .../classes/event-pipeline/Summary.cs | 24 +++++ .../Search-TssEventPipeline.ps1 | 6 +- src/parts/SearchEventPipelineList.ps1 | 99 ------------------- 6 files changed, 84 insertions(+), 103 deletions(-) create mode 100644 src/Thycotic.SecretServer/classes/event-pipeline/Summary.cs delete mode 100644 src/parts/SearchEventPipelineList.ps1 diff --git a/docs/commands/event-pipeline/Search-TssEventPipeline.md b/docs/commands/event-pipeline/Search-TssEventPipeline.md index 54d3493b..298e6af2 100644 --- a/docs/commands/event-pipeline/Search-TssEventPipeline.md +++ b/docs/commands/event-pipeline/Search-TssEventPipeline.md @@ -147,7 +147,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Thycotic.PowerShell.EventPipeline.List +### Thycotic.PowerShell.EventPipeline.Summary ## NOTES Requires TssSession object returned by New-TssSession diff --git a/src/Thycotic.SecretServer.Format.ps1xml b/src/Thycotic.SecretServer.Format.ps1xml index e4e99428..18bc775a 100644 --- a/src/Thycotic.SecretServer.Format.ps1xml +++ b/src/Thycotic.SecretServer.Format.ps1xml @@ -2287,5 +2287,52 @@ + + + + EventPipeline.Summary + + Thycotic.PowerShell.EventPipeline.Summary + + + + + + + + + + + + + + + + EventPipelinePolicyId + + + EventEntityType + + + EventPipelineId + + + EventPipelineName + + + CreatedDate + + + LastModifiedDate + + + LastModifiedDisplayName + + + + + + + diff --git a/src/Thycotic.SecretServer.Types.ps1xml b/src/Thycotic.SecretServer.Types.ps1xml index ede8fd40..a4cc826e 100644 --- a/src/Thycotic.SecretServer.Types.ps1xml +++ b/src/Thycotic.SecretServer.Types.ps1xml @@ -286,4 +286,13 @@ + + Thycotic.PowerShell.EventPipeline.Summary + + + EventEntityType + EventEntityTypeId + + + \ No newline at end of file diff --git a/src/Thycotic.SecretServer/classes/event-pipeline/Summary.cs b/src/Thycotic.SecretServer/classes/event-pipeline/Summary.cs new file mode 100644 index 00000000..b57765b5 --- /dev/null +++ b/src/Thycotic.SecretServer/classes/event-pipeline/Summary.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using Thycotic.PowerShell.Enums; + +namespace Thycotic.PowerShell.EventPipeline +{ + public class Summary + { + public bool Active { get; set; } + public DateTime? CreatedDate { get; set; } + public EventEntityType EventEntityTypeId { get; set; } + public string EventPipelineDescription { get; set; } + public int EventPipelineId { get; set; } + public string EventPipelineName { get; set; } + public int EventPipelinePolicyId { get; set; } + public int EventPipelinePolicyMapId { get; set; } + public bool IsSystem { get; set; } + public DateTime? LastModifiedDate { get; set; } + public string LastModifiedDisplayName { get; set; } + public int SortOrder { get; set; } + } +} \ No newline at end of file diff --git a/src/functions/event-pipeline/Search-TssEventPipeline.ps1 b/src/functions/event-pipeline/Search-TssEventPipeline.ps1 index 3e81f6be..005d3898 100644 --- a/src/functions/event-pipeline/Search-TssEventPipeline.ps1 +++ b/src/functions/event-pipeline/Search-TssEventPipeline.ps1 @@ -28,7 +28,7 @@ function Search-TssEventPipeline { Requires TssSession object returned by New-TssSession #> [CmdletBinding()] - [OutputType('Thycotic.PowerShell.EventPipeline.List')] + [OutputType('Thycotic.PowerShell.EventPipeline.Summary')] param ( # TssSession object created by New-TssSession for authentication [Parameter(Mandatory,ValueFromPipeline,Position = 0)] @@ -70,7 +70,7 @@ function Search-TssEventPipeline { if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { . $CheckVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation $restResponse = $null - $uri = $TssSession.ApiUrl, 'event-pipeline', 'list' -join '/' + $uri = $TssSession.ApiUrl, 'event-pipeline', 'summaries' -join '/' $uri = $uri, "sortBy[0].direction=asc&sortBy[0].name=$SortBy&take=$($TssSession.Take)" -join '?' $filters = @() @@ -102,7 +102,7 @@ function Search-TssEventPipeline { } if ($restResponse.records) { - . $SearchEventPipelineList $restResponse.records + [Thycotic.PowerShell.EventPipeline.Summary[]]$restResponse.records } else { Write-Warning "No valid session found" } diff --git a/src/parts/SearchEventPipelineList.ps1 b/src/parts/SearchEventPipelineList.ps1 deleted file mode 100644 index e6daded5..00000000 --- a/src/parts/SearchEventPipelineList.ps1 +++ /dev/null @@ -1,99 +0,0 @@ -param( - [Parameter(Position = 0)] - [PSCustomObject]$Object -) -process { - foreach ($pipeline in $Object) { - if ($pipeline.filterList) { - $filterLists = @() - foreach ($filter in $pipeline.filterList) { - $filterSettings = @() - if ($filter.settings.value) { - foreach ($setting in $filter.settings.value) { - $filterSettings += [Thycotic.PowerShell.EventPipeline.FilterSetting]@{ - EventPipelineFilterMapId = $setting.EventPipelineFilterMapId.value - EventPipelineFilterSettingValueMapId = $setting.EventPipelineFilterSettingValueMapId.value - OverrideDefault = $setting.OverrideDefault.value - SettingDisplay = $setting.SettingDisplay.value - SettingDisplayValue = $setting.SettingDisplayValue.value - SettingId = $setting.SettingId.value - SettingValue = $setting.SettingValue.value - UsingDefault = $setting.UsingDefault.value - } - } - } - $filterLists += [Thycotic.PowerShell.EventPipeline.FilterView]@{ - EventEntityTypeId = if (-not $filter.EventEntityTypeId.value) { 0 } else { $filter.EventEntityTypeId.value } - EventPipelineFilterDescription = $filter.EventPipelineFilterDescription.value - EventPipelineFilterDisplayName = $filter.EventPipelineFilterDisplayName.value - EventPipelineFilterId = $filter.EventPipelineFilterId.value - EventPipelineFilterMapId = $filter.EventPipelineFilterMapId.value - EventPipelineFilterName = $filter.EventPipelineFilterName.value - Settings = $filterSettings - SortOrder = $filter.SortOrder.value - } - } - } - if ($pipeline.taskList) { - $taskLists = @() - foreach ($task in $pipeline.taskList) { - $taskSettings = @() - if ($task.settings.value) { - foreach ($setting in $task.settings.value) { - $taskSettings += [Thycotic.PowerShell.EventPipeline.TaskSetting]@{ - EventPipelineTaskMapId = $setting.EventPipelineTaskMapId.value - EventPipelineTaskSettingValueMapId = $setting.EventPipelineTaskSettingValueMapId.value - OverrideDefault = $setting.OverrideDefault.value - SettingDisplay = $setting.SettingDisplay.value - SettingDisplayValue = $setting.SettingDisplayValue.value - SettingId = $setting.SettingId.value - SettingValue = $setting.SettingValue.value - UsingDefault = $setting.UsingDefault.value - } - } - } - $taskLists = [Thycotic.PowerShell.EventPipeline.TaskView]@{ - EventEntityTypeId = if (-not $task.EventEntityTypeId.value) { 0 } else { $task.EventEntityTypeId.value } - EventPipelineTaskDescription = $task.EventPipelineTaskDescription.value - EventPipelineTaskDisplayName = $task.EventPipelineTaskDisplayName.value - EventPipelineTaskId = $task.EventPipelineTaskId.value - EventPipelineTaskMapId = $task.EventPipelineTaskMapId.value - EventPipelineTaskName = $task.EventPipelineTaskName.value - IsMultiSelect = $task.IsMultiSelect.value - Settings = $taskSettings - SortOrder = $task.SortOrder.value - } - } - } - if ($pipeline.triggers) { - $triggerLists = @() - foreach ($trigger in $pipeline.triggers) { - $triggerLists = [Thycotic.PowerShell.EventPipeline.TriggerView]@{ - EntityTypeDisplayName = $trigger.EntityTypeDisplayName.value - EventActionId = $trigger.EventActionId.value - EventEntityTypeId = $trigger.EventEntityTypeId.value - EventPipelineId = $trigger.EventPipelineId.value - EventPipelineTriggerId = $trigger.EventPipelineTriggerId.value - TriggerDisplayName = $trigger.TriggerDisplayName.value - } - } - } - [Thycotic.PowerShell.EventPipeline.List] @{ - Active = $pipeline.active.value - CreatedDate = $pipeline.createdDate.value - EventEntityTypeId = if ([int]$pipeline.eventEntityTypeId -gt 0) { $pipeline.eventEntityTypeId } else { 0 } - EventPipelineDescription = $pipeline.eventPipelineDescription.value - EventPipelineId = $pipeline.eventPipelineId - EventPipelineName = $pipeline.eventPipelineName.value - EventPipelinePolicyId = $pipeline.eventPipelinePolicyId - EventPipelinePolicyMapId = if (-not $pipeline.eventPipelinePolicyMapId) { 0 } else { $pipeline.eventPipelinePolicyMapId } - FilterList = $filterLists - IsSystem = $pipeline.isSystem - LastModifiedDate = $pipeline.lastModifiedDate.value - LastModifiedDisplayName = $pipeline.lastModifiedDisplayName.value - SortOrder = $pipeline.sortOrder.value - TaskList = $taskLists - Triggers = $triggerLists - } - } -} \ No newline at end of file