Model/MachineAccountRecommendation.ps1

#
# Identity Security Cloud API - Machine Account Recommendation
# 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

Machine account discovery recommendation for an account.

.PARAMETER Id
Recommendation ID.
.PARAMETER AccountId
ID of the account the recommendation is for.
.PARAMETER SourceId
ID of the source the account belongs to.
.PARAMETER IsMachine
Indicates whether the account is recommended as a machine account.
.PARAMETER Explanation
Reasons that contributed to the recommendation.
.PARAMETER Created
Date and time when the recommendation was created.
.PARAMETER Recommendation
Recommendation result.
.PARAMETER RecommendationType
Type of recommendation.
.PARAMETER Algorithm
Algorithm that produced the recommendation.
.OUTPUTS

MachineAccountRecommendation<PSCustomObject>
#>


function Initialize-MachineAccountRecommendation {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AccountId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsMachine} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Explanation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Recommendation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RecommendationType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Algorithm}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "accountId" = ${AccountId}
            "sourceId" = ${SourceId}
            "isMachine" = ${IsMachine}
            "explanation" = ${Explanation}
            "created" = ${Created}
            "recommendation" = ${Recommendation}
            "recommendationType" = ${RecommendationType}
            "algorithm" = ${Algorithm}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineAccountRecommendation<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineAccountRecommendation<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineAccountRecommendation<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineAccountRecommendation
        $AllProperties = ("id", "accountId", "sourceId", "isMachine", "explanation", "created", "recommendation", "recommendationType", "algorithm")
        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 "id"))) { #optional property not found
            $Id = $null
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "accountId" = ${AccountId}
            "sourceId" = ${SourceId}
            "isMachine" = ${IsMachine}
            "explanation" = ${Explanation}
            "created" = ${Created}
            "recommendation" = ${Recommendation}
            "recommendationType" = ${RecommendationType}
            "algorithm" = ${Algorithm}
        }

        return $PSO
    }

}