machine-account-subtypes/src/PSSailpoint.MachineAccountSubtypes/Model/SubtypeTargetSummary.ps1

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

One row per connector type (`CONNECTOR`) or per source-tier subtype (`SOURCE`) from `GET /source-subtypes/v2/targets`.

.PARAMETER TargetType
No description available.
.PARAMETER TargetId
Scope key. Connector type for `CONNECTOR`. Source id for `SOURCE`.
.PARAMETER TargetName
Display label. Never null; falls back to `targetId`.
.PARAMETER SubtypeCount
Number of subtypes in this target group.
.PARAMETER SourceCount
Number of sources of this connector type for a `CONNECTOR` row. `1` on a `SOURCE` row. Sortable. Not filterable.
.OUTPUTS

SubtypeTargetSummary<PSCustomObject>
#>


function Initialize-SubtypeTargetSummary {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SOURCE", "CONNECTOR", "CONNECTOR_VARIANT")]
        [PSCustomObject]
        ${TargetType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TargetName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${SubtypeCount},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${SourceCount}
    )

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


        $PSO = [PSCustomObject]@{
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "targetName" = ${TargetName}
            "subtypeCount" = ${SubtypeCount}
            "sourceCount" = ${SourceCount}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SubtypeTargetSummary<PSCustomObject>

.DESCRIPTION

Convert from JSON to SubtypeTargetSummary<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SubtypeTargetSummary<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SubtypeTargetSummary
        $AllProperties = ("targetType", "targetId", "targetName", "subtypeCount", "sourceCount", "lastModified")
        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 "targetType"))) { #optional property not found
            $TargetType = $null
        } else {
            $TargetType = $JsonParameters.PSobject.Properties["targetType"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "targetType" = ${TargetType}
            "targetId" = ${TargetId}
            "targetName" = ${TargetName}
            "subtypeCount" = ${SubtypeCount}
            "sourceCount" = ${SourceCount}
            "lastModified" = ${LastModified}
        }

        return $PSO
    }

}