nerm/src/PSSailpoint.NERM/Model/LdapAction.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER WorkflowId
The workflow the workflow action belongs to.
.PARAMETER Description
The description of the workflow action.
.PARAMETER Archived
If the workflow action is archived or not.
.PARAMETER StoreType
the type of store.
.PARAMETER LdapActionUserRolesAttributes
No description available.
.PARAMETER WorkflowActionValueBuildersAttributes
No description available.
.PARAMETER WorkflowActionDirectoryGroupsAttributes
No description available.
.OUTPUTS

LdapAction<PSCustomObject>
#>


function Initialize-NERMLdapAction {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Archived} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Local", "Directory")]
        [String]
        ${StoreType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LdapActionUserRolesAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${WorkflowActionValueBuildersAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${WorkflowActionDirectoryGroupsAttributes}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "workflow_id" = ${WorkflowId}
            "description" = ${Description}
            "archived" = ${Archived}
            "store_type" = ${StoreType}
            "ldap_action_user_roles_attributes" = ${LdapActionUserRolesAttributes}
            "workflow_action_value_builders_attributes" = ${WorkflowActionValueBuildersAttributes}
            "workflow_action_directory_groups_attributes" = ${WorkflowActionDirectoryGroupsAttributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to LdapAction<PSCustomObject>

.DESCRIPTION

Convert from JSON to LdapAction<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

LdapAction<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMLdapAction
        $AllProperties = ("workflow_id", "description", "archived", "store_type", "ldap_action_user_roles_attributes", "workflow_action_value_builders_attributes", "workflow_action_directory_groups_attributes")
        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 'workflow_id' missing."
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "workflow_id" = ${WorkflowId}
            "description" = ${Description}
            "archived" = ${Archived}
            "store_type" = ${StoreType}
            "ldap_action_user_roles_attributes" = ${LdapActionUserRolesAttributes}
            "workflow_action_value_builders_attributes" = ${WorkflowActionValueBuildersAttributes}
            "workflow_action_directory_groups_attributes" = ${WorkflowActionDirectoryGroupsAttributes}
        }

        return $PSO
    }

}