machine-accounts/src/PSSailpoint.MachineAccounts/Model/MachineAccountV2AllOfRisk.ps1

#
# SailPoint Identity Security API - Machine Accounts
# 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

Risk for this machine account, set by enrichment. Null when no risk has been recorded or when risk enrichment is not enabled for the tenant. Read-only.

.PARAMETER Score
Risk score from 0 to 100. Null when only a severity has been recorded.
.PARAMETER Severity
Risk severity.
.OUTPUTS

MachineAccountV2AllOfRisk<PSCustomObject>
#>


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

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


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

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineAccountV2AllOfRisk<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineAccountV2AllOfRisk<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineAccountV2AllOfRisk<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineAccountV2AllOfRisk
        $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
    }

}