Model/Inteloutlieraccessitem.ps1

#
# Identity Security Cloud API - Intelligence
# 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

No summary available.

.DESCRIPTION

One outlier access-item row.

.PARAMETER Id
Stable identifier of the outlier access-item row.
.PARAMETER DisplayName
Display label of the risky access item.
.PARAMETER Description
Optional descriptive text for the risky access item.
.PARAMETER AccessType
Access item type.
.PARAMETER SourceName
Source name where the risky access item exists.
.PARAMETER ExtremelyRare
Indicates whether analytics marked this item as extremely rare.
.OUTPUTS

Inteloutlieraccessitem<PSCustomObject>
#>


function Initialize-Inteloutlieraccessitem {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AccessType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${ExtremelyRare}
    )

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

        if (!$Id) {
            throw "invalid value for 'Id', 'Id' cannot be null."
        }

        if (!$DisplayName) {
            throw "invalid value for 'DisplayName', 'DisplayName' cannot be null."
        }

        if (!$AccessType) {
            throw "invalid value for 'AccessType', 'AccessType' cannot be null."
        }

        if (!$SourceName) {
            throw "invalid value for 'SourceName', 'SourceName' cannot be null."
        }

        if (!$ExtremelyRare) {
            throw "invalid value for 'ExtremelyRare', 'ExtremelyRare' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "displayName" = ${DisplayName}
            "description" = ${Description}
            "accessType" = ${AccessType}
            "sourceName" = ${SourceName}
            "extremelyRare" = ${ExtremelyRare}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Inteloutlieraccessitem<PSCustomObject>

.DESCRIPTION

Convert from JSON to Inteloutlieraccessitem<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Inteloutlieraccessitem<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Inteloutlieraccessitem
        $AllProperties = ("id", "displayName", "description", "accessType", "sourceName", "extremelyRare")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'id' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) {
            throw "Error! JSON cannot be serialized due to the required property 'id' missing."
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "displayName"))) {
            throw "Error! JSON cannot be serialized due to the required property 'displayName' missing."
        } else {
            $DisplayName = $JsonParameters.PSobject.Properties["displayName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "accessType"))) {
            throw "Error! JSON cannot be serialized due to the required property 'accessType' missing."
        } else {
            $AccessType = $JsonParameters.PSobject.Properties["accessType"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "sourceName"))) {
            throw "Error! JSON cannot be serialized due to the required property 'sourceName' missing."
        } else {
            $SourceName = $JsonParameters.PSobject.Properties["sourceName"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "extremelyRare"))) {
            throw "Error! JSON cannot be serialized due to the required property 'extremelyRare' missing."
        } else {
            $ExtremelyRare = $JsonParameters.PSobject.Properties["extremelyRare"].value
        }

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "displayName" = ${DisplayName}
            "description" = ${Description}
            "accessType" = ${AccessType}
            "sourceName" = ${SourceName}
            "extremelyRare" = ${ExtremelyRare}
        }

        return $PSO
    }

}