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

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

A single anomaly detected for a machine identity by Agent Behavior Monitoring.

.PARAMETER Id
Anomaly identifier.
.PARAMETER AnomalyType
Category of the detected anomaly.
.PARAMETER Description
Human-readable description of the anomaly.
.PARAMETER RuleId
Identifier of the detection rule that produced the anomaly.
.PARAMETER DataSources
Source systems that contributed to the detection.
.PARAMETER DetectedAt
Date-time the anomaly was detected.
.PARAMETER Evidence
No description available.
.OUTPUTS

Anomaly<PSCustomObject>
#>


function Initialize-Anomaly {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AnomalyType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${RuleId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${DataSources},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${DetectedAt},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Evidence}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "anomalyType" = ${AnomalyType}
            "description" = ${Description}
            "ruleId" = ${RuleId}
            "dataSources" = ${DataSources}
            "detectedAt" = ${DetectedAt}
            "evidence" = ${Evidence}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Anomaly<PSCustomObject>

.DESCRIPTION

Convert from JSON to Anomaly<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Anomaly<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Anomaly
        $AllProperties = ("id", "anomalyType", "description", "ruleId", "dataSources", "detectedAt", "evidence")
        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 "anomalyType"))) { #optional property not found
            $AnomalyType = $null
        } else {
            $AnomalyType = $JsonParameters.PSobject.Properties["anomalyType"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "anomalyType" = ${AnomalyType}
            "description" = ${Description}
            "ruleId" = ${RuleId}
            "dataSources" = ${DataSources}
            "detectedAt" = ${DetectedAt}
            "evidence" = ${Evidence}
        }

        return $PSO
    }

}