machine-identities/src/PSSailpoint.MachineIdentities/Model/MachineIdentityRiskSeverityCounts.ps1

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

Number of machine identities in each risk severity. This object is `null` when agentic risk scoring is not enabled for the tenant.

.PARAMETER Critical
Number of machine identities with a CRITICAL risk severity.
.PARAMETER High
Number of machine identities with a HIGH risk severity.
.PARAMETER Medium
Number of machine identities with a MEDIUM risk severity.
.PARAMETER Low
Number of machine identities with a LOW risk severity.
.PARAMETER Unknown
Number of machine identities that have no risk severity. This value is `null` unless unclassified risk severity counting is enabled for the tenant. Version 1 of the API always returns `null`.
.OUTPUTS

MachineIdentityRiskSeverityCounts<PSCustomObject>
#>


function Initialize-MachineIdentityRiskSeverityCounts {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Critical},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${High},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Medium},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Low},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Unknown}
    )

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


        $PSO = [PSCustomObject]@{
            "critical" = ${Critical}
            "high" = ${High}
            "medium" = ${Medium}
            "low" = ${Low}
            "unknown" = ${Unknown}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineIdentityRiskSeverityCounts<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineIdentityRiskSeverityCounts<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineIdentityRiskSeverityCounts<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineIdentityRiskSeverityCounts
        $AllProperties = ("critical", "high", "medium", "low", "unknown")
        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 "critical"))) { #optional property not found
            $Critical = $null
        } else {
            $Critical = $JsonParameters.PSobject.Properties["critical"].value
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "critical" = ${Critical}
            "high" = ${High}
            "medium" = ${Medium}
            "low" = ${Low}
            "unknown" = ${Unknown}
        }

        return $PSO
    }

}