jit-activations/src/PSSailpoint.JitActivations/Api/JITActivationsApi.ps1

#
# Identity Security Cloud API - JIT Activations
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

Start JIT activation workflow

.DESCRIPTION

Starts a JIT Privileged (JIT P) activation workflow for the given entitlement connection and duration. The service performs quick validation; the workflow performs additional validation. The response is returned with HTTP 202 Accepted while the workflow initializes.

.PARAMETER Jitactivationactivaterequest
No description available.

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

Jitactivationactivateresponse
#>

function Start-ActivateWorkflowV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Jitactivationactivaterequest},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Start-ActivateWorkflowV1' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/jit-activations/v1/activate'

        if (!$Jitactivationactivaterequest) {
            throw "Error! The required parameter `Jitactivationactivaterequest` missing when calling startActivateWorkflowV1."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($Jitactivationactivaterequest -is [array])) {
            $LocalVarBodyParameter = $Jitactivationactivaterequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $Jitactivationactivaterequest | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }

        $LocalVarResult = Invoke-ApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Jitactivationactivateresponse" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Deactivate JIT activation workflow

.DESCRIPTION

Sends a signal to a running JIT Privileged (JIT P) activation workflow to deactivate. This request cannot be applied to a workflow that does not exist or whose execution has already completed. The client receives an error response in those cases. The response is returned with HTTP 202 Accepted after the signal is sent.

.PARAMETER Jitactivationdeactivaterequest
No description available.

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

Jitactivationdeactivateresponse
#>

function Start-DeactivateWorkflowV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Jitactivationdeactivaterequest},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Start-DeactivateWorkflowV1' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/jit-activations/v1/deactivate'

        if (!$Jitactivationdeactivaterequest) {
            throw "Error! The required parameter `Jitactivationdeactivaterequest` missing when calling startDeactivateWorkflowV1."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($Jitactivationdeactivaterequest -is [array])) {
            $LocalVarBodyParameter = $Jitactivationdeactivaterequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $Jitactivationdeactivaterequest | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }

        $LocalVarResult = Invoke-ApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Jitactivationdeactivateresponse" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Extend JIT activation workflow

.DESCRIPTION

Sends a signal to a running JIT Privileged (JIT P) activation workflow to extend the activation period by the requested number of minutes. This request cannot be applied to a workflow that does not exist or whose execution has already completed. The client receives an error response in those cases. The response is returned with HTTP 202 Accepted after the signal is sent.

.PARAMETER Jitactivationextendrequest
No description available.

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

Jitactivationextendresponse
#>

function Start-ExtendWorkflowV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Jitactivationextendrequest},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Start-ExtendWorkflowV1' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/jit-activations/v1/extend'

        if (!$Jitactivationextendrequest) {
            throw "Error! The required parameter `Jitactivationextendrequest` missing when calling startExtendWorkflowV1."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($Jitactivationextendrequest -is [array])) {
            $LocalVarBodyParameter = $Jitactivationextendrequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $Jitactivationextendrequest | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }

        $LocalVarResult = Invoke-ApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Jitactivationextendresponse" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}