Model/RequestMetadataTermsValue.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
RequestMetadataTermsValue<PSCustomObject>
#>


function New-RequestMetadataTermsValue {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TermStore},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TermGroup},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${TermSet},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Value}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => RequestMetadataTermsValue' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "TermStore" = ${TermStore}
            "TermGroup" = ${TermGroup}
            "TermSet" = ${TermSet}
            "Value" = ${Value}
        }

        return $PSO
    }
}

<#
RequestMetadataTermsValue<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => RequestMetadataTermsValue' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in RequestMetadataTermsValue
        $AllProperties = $("TermStore", "TermGroup", "TermSet", "Value")
        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 "TermStore"))) { #optional property not found
            $TermStore = $null
        } else {
            $TermStore = $JsonParameters.PSobject.Properties["TermStore"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "TermStore" = ${TermStore}
            "TermGroup" = ${TermGroup}
            "TermSet" = ${TermSet}
            "Value" = ${Value}
        }

        return $PSO
    }

}