Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable/Disable-TssEventPipeline - new commands
- Loading branch information
Showing
7 changed files
with
393 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
103 changes: 103 additions & 0 deletions
103
docs/commands/event-pipeline/Disable-TssEventPipeline.md
This file contains 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,103 @@ | ||
# Disable-TssEventPipeline | ||
|
||
## SYNOPSIS | ||
Disable an Event Pipeline of an Event Pipeline Policy | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Disable-TssEventPipeline [-TssSession] <Session> -Id <Int32[]> [-WhatIf] [-Confirm] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
Disable an Event Pipeline of an Event Pipeline Policy | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
``` | ||
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred | ||
Disable-TssEventPipeline -TssSession $session -Id 43 | ||
``` | ||
|
||
Disable Event Pipeline 43 | ||
|
||
## 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 | ||
``` | ||
|
||
### -Id | ||
Event Pipeline ID to Disable | ||
|
||
```yaml | ||
Type: Int32[] | ||
Parameter Sets: (All) | ||
Aliases: EventPipelineId | ||
|
||
Required: True | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: True (ByPropertyName) | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -WhatIf | ||
Shows what would happen if the cmdlet runs. | ||
The cmdlet is not run. | ||
|
||
```yaml | ||
Type: SwitchParameter | ||
Parameter Sets: (All) | ||
Aliases: wi | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -Confirm | ||
Prompts you for confirmation before running the cmdlet. | ||
|
||
```yaml | ||
Type: SwitchParameter | ||
Parameter Sets: (All) | ||
Aliases: cf | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
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 | ||
|
||
## NOTES | ||
Requires TssSession object returned by New-TssSession | ||
|
||
## RELATED LINKS | ||
|
||
[https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Disable-TssEventPipeline](https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Disable-TssEventPipeline) | ||
|
||
[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Disable-TssEventPipeline.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Disable-TssEventPipeline.ps1) | ||
|
103 changes: 103 additions & 0 deletions
103
docs/commands/event-pipeline/Enable-TssEventPipeline.md
This file contains 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,103 @@ | ||
# Enable-TssEventPipeline | ||
|
||
## SYNOPSIS | ||
Enable an Event Pipeline of an Event Pipeline Policy | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Enable-TssEventPipeline [-TssSession] <Session> -Id <Int32[]> [-WhatIf] [-Confirm] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
Enable an Event Pipeline of an Event Pipeline Policy | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
``` | ||
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred | ||
Enable-TssEventPipeline -TssSession $session -Id 43 | ||
``` | ||
|
||
Enable Event Pipeline 43 | ||
|
||
## 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 | ||
``` | ||
|
||
### -Id | ||
Event Pipeline ID to enable | ||
|
||
```yaml | ||
Type: Int32[] | ||
Parameter Sets: (All) | ||
Aliases: EventPipelineId | ||
|
||
Required: True | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: True (ByPropertyName) | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -WhatIf | ||
Shows what would happen if the cmdlet runs. | ||
The cmdlet is not run. | ||
|
||
```yaml | ||
Type: SwitchParameter | ||
Parameter Sets: (All) | ||
Aliases: wi | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -Confirm | ||
Prompts you for confirmation before running the cmdlet. | ||
|
||
```yaml | ||
Type: SwitchParameter | ||
Parameter Sets: (All) | ||
Aliases: cf | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
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 | ||
|
||
## NOTES | ||
Requires TssSession object returned by New-TssSession | ||
|
||
## RELATED LINKS | ||
|
||
[https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Enable-TssEventPipeline](https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Enable-TssEventPipeline) | ||
|
||
[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Enable-TssEventPipeline.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Enable-TssEventPipeline.ps1) | ||
|
This file contains 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,73 @@ | ||
function Disable-TssEventPipeline { | ||
<# | ||
.SYNOPSIS | ||
Disable an Event Pipeline of an Event Pipeline Policy | ||
.DESCRIPTION | ||
Disable an Event Pipeline of an Event Pipeline Policy | ||
.EXAMPLE | ||
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred | ||
Disable-TssEventPipeline -TssSession $session -Id 43 | ||
Disable Event Pipeline 43 | ||
.LINK | ||
https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Disable-TssEventPipeline | ||
.LINK | ||
https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Disable-TssEventPipeline.ps1 | ||
.NOTES | ||
Requires TssSession object returned by New-TssSession | ||
#> | ||
[CmdletBinding(SupportsShouldProcess)] | ||
param ( | ||
# TssSession object created by New-TssSession for authentication | ||
[Parameter(Mandatory, ValueFromPipeline, Position = 0)] | ||
[Thycotic.PowerShell.Authentication.Session] | ||
$TssSession, | ||
|
||
# Event Pipeline ID to Disable | ||
[Parameter(Mandatory, ValueFromPipelineByPropertyName)] | ||
[Alias('EventPipelineId')] | ||
[int[]] | ||
$Id | ||
) | ||
begin { | ||
$tssParams = $PSBoundParameters | ||
$invokeParams = . $GetInvokeTssParams $TssSession | ||
} | ||
process { | ||
Write-Verbose "Provided command parameters: $(. $GetInvocation $PSCmdlet.MyInvocation)" | ||
if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { | ||
. $CheckVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation | ||
foreach ($pipeline in $Id) { | ||
$uri = $TssSession.ApiUrl, 'event-pipeline', $pipeline, 'activate' -join '/' | ||
$invokeParams.Uri = $uri | ||
$invokeParams.Method = 'PUT' | ||
|
||
$DisablePipelineBody = @{ Activate = $false } | ||
$invokeParams.Body = $DisablePipelineBody | ConvertTo-Json | ||
if ($PSCmdlet.ShouldProcess("description: $", "$($invokeParams.Method) $uri with: `n$($invokeParams.Body)")) { | ||
Write-Verbose "$($invokeParams.Method) $uri with: `n$($invokeParams.Body)" | ||
try { | ||
$restResponse = . $InvokeApi @invokeParams | ||
} catch { | ||
Write-Warning 'Issue warning message' | ||
$err = $_ | ||
. $ErrorHandling $err | ||
} | ||
|
||
if (-not $restResponse) { | ||
Write-Verbose "Event Pipeline [$pipeline] Disabled" | ||
} else { | ||
Write-Warning "Event Pipeline [$pipeline] not successfully Disabled" | ||
} | ||
} | ||
} | ||
} else { | ||
Write-Warning 'No valid session found' | ||
} | ||
} | ||
} |
This file contains 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,73 @@ | ||
function Enable-TssEventPipeline { | ||
<# | ||
.SYNOPSIS | ||
Enable an Event Pipeline of an Event Pipeline Policy | ||
.DESCRIPTION | ||
Enable an Event Pipeline of an Event Pipeline Policy | ||
.EXAMPLE | ||
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred | ||
Enable-TssEventPipeline -TssSession $session -Id 43 | ||
Enable Event Pipeline 43 | ||
.LINK | ||
https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline/Enable-TssEventPipeline | ||
.LINK | ||
https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline/Enable-TssEventPipeline.ps1 | ||
.NOTES | ||
Requires TssSession object returned by New-TssSession | ||
#> | ||
[CmdletBinding(SupportsShouldProcess)] | ||
param ( | ||
# TssSession object created by New-TssSession for authentication | ||
[Parameter(Mandatory, ValueFromPipeline, Position = 0)] | ||
[Thycotic.PowerShell.Authentication.Session] | ||
$TssSession, | ||
|
||
# Event Pipeline ID to enable | ||
[Parameter(Mandatory, ValueFromPipelineByPropertyName)] | ||
[Alias('EventPipelineId')] | ||
[int[]] | ||
$Id | ||
) | ||
begin { | ||
$tssParams = $PSBoundParameters | ||
$invokeParams = . $GetInvokeTssParams $TssSession | ||
} | ||
process { | ||
Write-Verbose "Provided command parameters: $(. $GetInvocation $PSCmdlet.MyInvocation)" | ||
if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { | ||
. $CheckVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation | ||
foreach ($pipeline in $Id) { | ||
$uri = $TssSession.ApiUrl, 'event-pipeline', $pipeline, 'activate' -join '/' | ||
$invokeParams.Uri = $uri | ||
$invokeParams.Method = 'PUT' | ||
|
||
$enablePipelineBody = @{ Activate = $true } | ||
$invokeParams.Body = $enablePipelineBody | ConvertTo-Json | ||
if ($PSCmdlet.ShouldProcess("description: $pipeline", "$($invokeParams.Method) $uri with: `n$($invokeParams.Body)")) { | ||
Write-Verbose "$($invokeParams.Method) $uri with: `n$($invokeParams.Body)" | ||
try { | ||
$restResponse = . $InvokeApi @invokeParams | ||
} catch { | ||
Write-Warning 'Issue warning message' | ||
$err = $_ | ||
. $ErrorHandling $err | ||
} | ||
|
||
if ($restResponse) { | ||
Write-Verbose "Event Pipeline [$pipeline] enabled" | ||
} else { | ||
Write-Warning "Event Pipeline [$pipeline] not successfully enabled" | ||
} | ||
} | ||
} | ||
} else { | ||
Write-Warning 'No valid session found' | ||
} | ||
} | ||
} |
Oops, something went wrong.