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

Summary of the subtypes defined for one target. There is one item per connector type for `CONNECTOR` targets, and one item per source subtype for `SOURCE` targets.

.PARAMETER TargetType
Tier of the target.
.PARAMETER TargetId
Connector type for a `CONNECTOR` target, or source ID for a `SOURCE` target.
.PARAMETER TargetName
Display name of the target. Falls back to `targetId` when no name is stored.
.PARAMETER SubtypeCount
Number of subtypes defined for the target.
.PARAMETER SourceCount
Number of sources the target's subtypes apply to.
.PARAMETER LastModified
Most recent modification time across the target's subtypes.
.OUTPUTS

SubtypeTargetSummary<PSCustomObject>
#>


function Initialize-SubtypeTargetSummary {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SOURCE", "CONNECTOR")]
        [String]
        ${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},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${LastModified}
    )

    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}
            "lastModified" = ${LastModified}
        }

        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
    }

}