nerm/src/PSSailpoint.NERM/Api/NERMSyncedAttributesApi.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

Create a synced attribute

.DESCRIPTION

Create synced attribute

.PARAMETER SyncedAttribute1
No description available.

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

CreateSyncedAttribute201Response
#>

function New-NERMSyncedAttribute {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Collections.Hashtable]
        ${SyncedAttribute1},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: New-NERMSyncedAttribute' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/profile_types/{profile_type_id}/synced_attributes'

        if (!$SyncedAttribute1) {
            throw "Error! The required parameter `SyncedAttribute1` missing when calling createSyncedAttribute."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($SyncedAttribute1 -is [array])) {
            $LocalVarBodyParameter = $SyncedAttribute1 | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $SyncedAttribute1 | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "CreateSyncedAttribute201Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Delete synced attribute

.DESCRIPTION

Delete a synced attribute.

.PARAMETER ProfileTypeId
Profile Type ID for filtering

.PARAMETER NeAttributeId
ID of an attribute for filtering

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

DeleteProfileTypeById200Response
#>

function Remove-NERMSyncedAttribute {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${ProfileTypeId},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${NeAttributeId},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Remove-NERMSyncedAttribute' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        $LocalVarUri = '/profile_types/{profile_type_id}/synced_attributes/{ne_attribute_id}'

        if ($ProfileTypeId) {
            $LocalVarQueryParameters['profile_type_id'] = $ProfileTypeId
        }

        if ($NeAttributeId) {
            $LocalVarQueryParameters['ne_attribute_id'] = $NeAttributeId
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'DELETE' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "DeleteProfileTypeById200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

profile_types/ne_attributes synced status

.DESCRIPTION

Get ne attributes and synced attribute relationship to profile type.

.PARAMETER ProfileTypeId
Profile Type ID for filtering

.PARAMETER ActiveFilter
Filter for profile type synced attributes

.PARAMETER Search
Filter by string

.PARAMETER Page
Pagination items per page

.PARAMETER Sort
How records should be sorted

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

GetProfileTypeAttributes200Response
#>

function Get-NERMProfileTypeAttributes {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${ProfileTypeId},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("synced", "unsynced", "all")]
        [String]
        ${ActiveFilter},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Search},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Int32]]
        ${Page},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Sort},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Get-NERMProfileTypeAttributes' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        $LocalVarUri = '/profile_types/{profile_type_id}/ne_attributes'

        if ($ProfileTypeId) {
            $LocalVarQueryParameters['profile_type_id'] = $ProfileTypeId
        }

        if ($ActiveFilter) {
            $LocalVarQueryParameters['active_filter'] = $ActiveFilter
        }

        if ($Search) {
            $LocalVarQueryParameters['search'] = $Search
        }

        if ($Page) {
            $LocalVarQueryParameters['page'] = $Page
        }

        if ($Sort) {
            $LocalVarQueryParameters['sort'] = $Sort
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'GET' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "GetProfileTypeAttributes200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}