personal-access-tokens/src/PSSailpoint.PersonalAccessTokens/Model/BulkUpdatePersonalAccessTokensRequest.ps1

#
# Identity Security Cloud API - Personal Access Tokens
# 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

Request body for bulk updating personal access tokens. A single JSON Patch document is applied to every personal access token referenced in `ids`.

.PARAMETER Ids
The IDs of the personal access tokens to update. All IDs must reference personal access tokens that exist in the current tenant. Duplicate and blank values are not allowed.
.PARAMETER Patch
A single [JSON Patch](https://tools.ietf.org/html/rfc6902) document that is applied identically to every personal access token referenced in `ids`. Only the following paths are allowed for bulk updates: * `/expirationDate` - Set (`replace`) or clear (`remove`) the token's expiration. * `/userAwareTokenNeverExpires` - Explicit acknowledgment required when clearing `expirationDate`. Any other path (for example `/name` or `/scope`) results in a `400` response.
.OUTPUTS

BulkUpdatePersonalAccessTokensRequest<PSCustomObject>
#>


function Initialize-BulkUpdatePersonalAccessTokensRequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${Ids},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Patch}
    )

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

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

        if ($Ids.length -gt 25) {
            throw "invalid value for 'Ids', number of items must be less than or equal to 25."
        }

        if ($Ids.length -lt 1) {
            throw "invalid value for 'Ids', number of items must be greater than or equal to 1."
        }

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

        if ($Patch.length -lt 1) {
            throw "invalid value for 'Patch', number of items must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "ids" = ${Ids}
            "patch" = ${Patch}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to BulkUpdatePersonalAccessTokensRequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to BulkUpdatePersonalAccessTokensRequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

BulkUpdatePersonalAccessTokensRequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BulkUpdatePersonalAccessTokensRequest
        $AllProperties = ("ids", "patch")
        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 'ids' missing."
        }

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

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

        $PSO = [PSCustomObject]@{
            "ids" = ${Ids}
            "patch" = ${Patch}
        }

        return $PSO
    }

}