devices/src/PSSailpoint.Devices/Model/DeviceOSCounts.ps1

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

The number of devices for each operating system.

.PARAMETER Macos
The number of macOS devices.
.PARAMETER Windows
The number of Windows devices.
.PARAMETER Linux
The number of Linux devices.
.PARAMETER Unknown
The number of devices whose operating system is missing or is not macOS, Windows, or Linux.
.OUTPUTS

DeviceOSCounts<PSCustomObject>
#>


function Initialize-DeviceOSCounts {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Macos},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Windows},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Linux},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Unknown}
    )

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


        $PSO = [PSCustomObject]@{
            "macos" = ${Macos}
            "windows" = ${Windows}
            "linux" = ${Linux}
            "unknown" = ${Unknown}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to DeviceOSCounts<PSCustomObject>

.DESCRIPTION

Convert from JSON to DeviceOSCounts<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

DeviceOSCounts<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

        $PSO = [PSCustomObject]@{
            "macos" = ${Macos}
            "windows" = ${Windows}
            "linux" = ${Linux}
            "unknown" = ${Unknown}
        }

        return $PSO
    }

}