Model/Searchdocuments.ps1
|
# # Identity Security Cloud API - Search # 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 No description available. .PARAMETER Json JSON object .OUTPUTS Searchdocuments<PSCustomObject> #> function ConvertFrom-JsonToSearchdocuments { [CmdletBinding()] Param ( [AllowEmptyString()] [string]$Json ) Process { $match = 0 $matchType = $null $matchInstance = $null # try to match Accessprofiledocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToAccessprofiledocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Accessprofiledocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Accessprofiledocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } # try to match Accountactivitydocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToAccountactivitydocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Accountactivitydocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Accountactivitydocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } # try to match Entitlementdocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToEntitlementdocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Entitlementdocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Entitlementdocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } # try to match Eventdocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToEventdocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Eventdocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Eventdocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } # try to match Identitydocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToIdentitydocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Identitydocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Identitydocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } # try to match Roledocuments defined in the oneOf schemas try { $matchInstance = ConvertFrom-JsonToRoledocuments $Json foreach($property in $matchInstance.PsObject.Properties) { if ($null -ne $property.Value) { $matchType = "Roledocuments" $match++ break } } } catch { # fail to match the schema defined in oneOf, proceed to the next one Write-Debug "Failed to match 'Roledocuments' defined in oneOf (Searchdocuments). Proceeding to the next one if any." } if ($match -gt 1) { throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Accessprofiledocuments, Accountactivitydocuments, Entitlementdocuments, Eventdocuments, Identitydocuments, Roledocuments]). JSON Payload: $($Json)" } elseif ($match -eq 1) { return [PSCustomObject]@{ "ActualType" = ${matchType} "ActualInstance" = ${matchInstance} "OneOfSchemas" = @("Accessprofiledocuments", "Accountactivitydocuments", "Entitlementdocuments", "Eventdocuments", "Identitydocuments", "Roledocuments") } } else { throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Accessprofiledocuments, Accountactivitydocuments, Entitlementdocuments, Eventdocuments, Identitydocuments, Roledocuments]). JSON Payload: $($Json)" } } } |