Model/MachineIdentityV2Risk.ps1

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

Risk data for the machine identity; null when no risk data has landed yet.

.PARAMETER Score
Normalised risk score 0.0-100.0.
.PARAMETER Severity
Risk severity bucket.
.OUTPUTS

MachineIdentityV2Risk<PSCustomObject>
#>


function Initialize-MachineIdentityV2Risk {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Double]]
        ${Score},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CRITICAL", "HIGH", "MEDIUM", "LOW")]
        [String]
        ${Severity}
    )

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


        $PSO = [PSCustomObject]@{
            "score" = ${Score}
            "severity" = ${Severity}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineIdentityV2Risk<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineIdentityV2Risk<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineIdentityV2Risk<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineIdentityV2Risk
        $AllProperties = ("score", "severity")
        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 "score"))) { #optional property not found
            $Score = $null
        } else {
            $Score = $JsonParameters.PSobject.Properties["score"].value
        }

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

        $PSO = [PSCustomObject]@{
            "score" = ${Score}
            "severity" = ${Severity}
        }

        return $PSO
    }

}