business-applications/src/PSSailpoint.BusinessApplications/Model/BusinessApplication.ps1

#
# Identity Security Cloud API - Business Applications
# 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 Business Application groups machine identities (for example AI agents or applications) under a common owner and sanctioned status, either discovered from a source or defined by an administrator.

.PARAMETER Name
Human-readable display name. Must be unique within the tenant.
.PARAMETER Description
Free-text description of the Business Application.
.PARAMETER Vendor
Vendor or publisher of the Business Application.
.PARAMETER Signatures
Signatures used to automatically correlate machine identities to this Business Application. Modifying this field requires the custom Business Application feature to be enabled.
.PARAMETER Owner
No description available.
.PARAMETER AdditionalOwners
Additional (secondary) owners of the Business Application.
.PARAMETER SanctionedStatus
Sanctioned status of the Business Application. Defaults to `UNKNOWN`.
.PARAMETER Source
No description available.
.OUTPUTS

BusinessApplication<PSCustomObject>
#>


function Initialize-BusinessApplication {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Vendor},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Signatures},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${AdditionalOwners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SANCTIONED", "UNSANCTIONED", "UNKNOWN")]
        [PSCustomObject]
        ${SanctionedStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source}
    )

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

        if (!$Name) {
            throw "invalid value for 'Name', 'Name' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "description" = ${Description}
            "vendor" = ${Vendor}
            "signatures" = ${Signatures}
            "owner" = ${Owner}
            "additionalOwners" = ${AdditionalOwners}
            "sanctionedStatus" = ${SanctionedStatus}
            "source" = ${Source}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to BusinessApplication<PSCustomObject>

.DESCRIPTION

Convert from JSON to BusinessApplication<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

BusinessApplication<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BusinessApplication
        $AllProperties = ("id", "name", "description", "vendor", "signatures", "owner", "additionalOwners", "sanctionedStatus", "origin", "source", "created", "modified")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'name' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) {
            throw "Error! JSON cannot be serialized due to the required property 'name' missing."
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

        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 "description"))) { #optional property not found
            $Description = $null
        } else {
            $Description = $JsonParameters.PSobject.Properties["description"].value
        }

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

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

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

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "source"))) { #optional property not found
            $Source = $null
        } else {
            $Source = $JsonParameters.PSobject.Properties["source"].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 "modified"))) { #optional property not found
            $Modified = $null
        } else {
            $Modified = $JsonParameters.PSobject.Properties["modified"].value
        }

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "description" = ${Description}
            "vendor" = ${Vendor}
            "signatures" = ${Signatures}
            "owner" = ${Owner}
            "additionalOwners" = ${AdditionalOwners}
            "sanctionedStatus" = ${SanctionedStatus}
            "origin" = ${Origin}
            "source" = ${Source}
            "created" = ${Created}
            "modified" = ${Modified}
        }

        return $PSO
    }

}