Api/MachineAccountClassifyApi.ps1

#
# SailPoint Identity Security API - Machine Account Classify
# Use these APIs to interact with the SailPoint Identity Security 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

Classify multiple machine accounts

.DESCRIPTION

Use this API to classify up to 250 accounts in one request. The response lists a result for each requested account, with its own status code, so some accounts can succeed while others fail. A token with API, ORG_ADMIN, SOURCE_ADMIN, or SOURCE_SUBADMIN authority is required to call this API. When machine account classification is not enabled for the tenant, this API returns `404`.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER BulkClassifyMachineAccountsRequest
No description available.

.PARAMETER ClassificationMode
Specifies how the accounts should be classified. default - uses criteria to classify account as machine or human, excludes accounts that were manually classified. ignoreManual - like default, but includes accounts that were manually classified. forceMachine - forces account to be classified as machine. forceHuman - forces account to be classified as human.

.PARAMETER WithHttpInfo

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

.OUTPUTS

BulkClassifyMachineAccountResult[]
#>

function Send-BulkClassifyMachineAccountsV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${BulkClassifyMachineAccountsRequest},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("default", "ignoreManual", "forceMachine", "forceHuman")]
        [String]
        ${ClassificationMode},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Send-BulkClassifyMachineAccountsV1' | 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 = '/accounts/v1/bulk-classify'

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling sendBulkClassifyMachineAccountsV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

        if ($ClassificationMode) {
            $LocalVarQueryParameters['classificationMode'] = $ClassificationMode
        }

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

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($BulkClassifyMachineAccountsRequest -is [array])) {
            $LocalVarBodyParameter = $BulkClassifyMachineAccountsRequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $BulkClassifyMachineAccountsRequest | 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-ApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "BulkClassifyMachineAccountResult[]" `
                                -IsBodyNullable $false

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

<#
.SYNOPSIS

Classify single machine account

.DESCRIPTION

Use this API to classify a single machine account. A token with API, ORG_ADMIN, SOURCE_ADMIN, or SOURCE_SUBADMIN authority is required to call this API.

.PARAMETER Id
Account ID.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER ClassificationMode
Specifies how the accounts should be classified. default - uses criteria to classify account as machine or human, excludes accounts that were manually classified. ignoreManual - like default, but includes accounts that were manually classified. forceMachine - forces account to be classified as machine. forceHuman - forces account to be classified as human.

.PARAMETER WithHttpInfo

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

.OUTPUTS

SendClassifyMachineAccountV1200Response
#>

function Send-ClassifyMachineAccountV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("default", "ignoreManual", "forceMachine", "forceHuman")]
        [String]
        ${ClassificationMode},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Send-ClassifyMachineAccountV1' | 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 = '/accounts/v1/{id}/classify'
        if (!$Id) {
            throw "Error! The required parameter `Id` missing when calling sendClassifyMachineAccountV1."
        }
        $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id))

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling sendClassifyMachineAccountV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

        if ($ClassificationMode) {
            $LocalVarQueryParameters['classificationMode'] = $ClassificationMode
        }

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

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