intelligence/src/PSSailpoint.Intelligence/Model/Intelnhirisksignals.ps1

#
# SailPoint Identity Security API - Intelligence
# Use these APIs to interact with the SailPoint Identity Security 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

No summary available.

.DESCRIPTION

First page of risk factors for a non-human identity, strongest first. Either success fields (`items`, optional `totalCount` and `next`) or failure fields (`message`, `reason`), never both. Present on every NHI lookup. When `risk` is null, `items` may be an empty array.

.PARAMETER Items
First page of risk factors.
.PARAMETER TotalCount
Total number of risk factors. Omitted when `items` is empty.
.PARAMETER Next
URL for the next page of risk factors. Omitted when everything fits on this page.
.PARAMETER Message
Set when risk factors could not be loaded. `items`, `totalCount`, and `next` are omitted.
.PARAMETER Reason
No description available.
.OUTPUTS

Intelnhirisksignals<PSCustomObject>
#>


function Initialize-Intelnhirisksignals {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Items},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${TotalCount},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Next},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Message},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RESOURCE_NOT_FOUND", "UPSTREAM_UNAVAILABLE")]
        [PSCustomObject]
        ${Reason}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint.Intelligence => Intelnhirisksignals' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        if ($TotalCount -and $TotalCount -lt 1) {
          throw "invalid value for 'TotalCount', must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "items" = ${Items}
            "totalCount" = ${TotalCount}
            "next" = ${Next}
            "message" = ${Message}
            "reason" = ${Reason}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Intelnhirisksignals<PSCustomObject>

.DESCRIPTION

Convert from JSON to Intelnhirisksignals<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Intelnhirisksignals<PSCustomObject>
#>

function ConvertFrom-JsonToIntelnhirisksignals {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: PSSailpoint.Intelligence => Intelnhirisksignals' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Intelnhirisksignals
        $AllProperties = ("items", "totalCount", "next", "message", "reason")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "items"))) { #optional property not found
            $Items = $null
        } else {
            $Items = $JsonParameters.PSobject.Properties["items"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "totalCount"))) { #optional property not found
            $TotalCount = $null
        } else {
            $TotalCount = $JsonParameters.PSobject.Properties["totalCount"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "next"))) { #optional property not found
            $Next = $null
        } else {
            $Next = $JsonParameters.PSobject.Properties["next"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "message"))) { #optional property not found
            $Message = $null
        } else {
            $Message = $JsonParameters.PSobject.Properties["message"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "reason"))) { #optional property not found
            $Reason = $null
        } else {
            $Reason = $JsonParameters.PSobject.Properties["reason"].value
        }

        $PSO = [PSCustomObject]@{
            "items" = ${Items}
            "totalCount" = ${TotalCount}
            "next" = ${Next}
            "message" = ${Message}
            "reason" = ${Reason}
        }

        return $PSO
    }

}