access-profiles/src/PSSailpoint.AccessProfiles/Model/Accessprofilemetadatabulkupdatebyidrequest.ps1

#
# Identity Security Cloud API - Access Profiles
# 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 to bulk update Access Model Metadata on a list of access profiles identified by ID. The maximum access profile count in a single request is 3000. A single access profile cannot be assigned more than 25 metadata values. Adding or replacing custom metadata requires a suite license.

.PARAMETER AccessProfiles
The IDs of the access profiles to update.
.PARAMETER Operation
The operation to be performed
.PARAMETER ReplaceScope
The choice of update scope. **ATTRIBUTE** replaces only the values of the attributes named in `values`, and **ALL** replaces every metadata attribute on the access profile.
.PARAMETER Values
The metadata to be updated, including attribute key and value.
.OUTPUTS

Accessprofilemetadatabulkupdatebyidrequest<PSCustomObject>
#>


function Initialize-Accessprofilemetadatabulkupdatebyidrequest {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${AccessProfiles},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ADD", "REMOVE", "REPLACE")]
        [String]
        ${Operation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ALL", "ATTRIBUTE")]
        [String]
        ${ReplaceScope},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Values}
    )

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "accessProfiles" = ${AccessProfiles}
            "operation" = ${Operation}
            "replaceScope" = ${ReplaceScope}
            "values" = ${Values}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Accessprofilemetadatabulkupdatebyidrequest<PSCustomObject>

.DESCRIPTION

Convert from JSON to Accessprofilemetadatabulkupdatebyidrequest<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Accessprofilemetadatabulkupdatebyidrequest<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Accessprofilemetadatabulkupdatebyidrequest
        $AllProperties = ("accessProfiles", "operation", "replaceScope", "values")
        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 'accessProfiles' missing."
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "accessProfiles" = ${AccessProfiles}
            "operation" = ${Operation}
            "replaceScope" = ${ReplaceScope}
            "values" = ${Values}
        }

        return $PSO
    }

}