Model/Device.ps1
|
# # Identity Security Cloud API - Devices # 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 A device, such as a laptop or server, discovered from a connected source. .PARAMETER Name Name of the Object .PARAMETER NativeIdentity The device's unique identifier on the source. .PARAMETER Description Description of the device. .PARAMETER Environment The environment the device belongs to. .PARAMETER Hostname The device hostname reported by the source. .PARAMETER Os No description available. .PARAMETER Email The email address the source reports for the device. .PARAMETER SentinelVersion The version of the endpoint agent the source reports for the device. .PARAMETER DetectionModuleVersion The version of the detection module the source reports for the device. .PARAMETER Source No description available. .PARAMETER Resource No description available. .PARAMETER DatasetId The ID of the source dataset the device was retrieved from. .PARAMETER Owners No description available. .PARAMETER ConnectorAttributes A map of attributes sourced from the connector during aggregation. .PARAMETER Attributes A map of curated device attributes. .OUTPUTS Device<PSCustomObject> #> function Initialize-Device { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Name}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${NativeIdentity}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Description}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Environment}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Hostname}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Os}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Email}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${SentinelVersion}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${DetectionModuleVersion}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Source}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Resource}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${DatasetId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${Owners}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Collections.Hashtable] ${ConnectorAttributes}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Collections.Hashtable] ${Attributes} ) Process { 'Creating PSCustomObject: PSSailpoint.Devices => Device' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "name" = ${Name} "nativeIdentity" = ${NativeIdentity} "description" = ${Description} "environment" = ${Environment} "hostname" = ${Hostname} "os" = ${Os} "email" = ${Email} "sentinelVersion" = ${SentinelVersion} "detectionModuleVersion" = ${DetectionModuleVersion} "source" = ${Source} "resource" = ${Resource} "datasetId" = ${DatasetId} "owners" = ${Owners} "connectorAttributes" = ${ConnectorAttributes} "attributes" = ${Attributes} } return $PSO } } <# .SYNOPSIS Convert from JSON to Device<PSCustomObject> .DESCRIPTION Convert from JSON to Device<PSCustomObject> .PARAMETER Json Json object .OUTPUTS Device<PSCustomObject> #> function ConvertFrom-JsonToDevice { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: PSSailpoint.Devices => Device' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in Device $AllProperties = ("id", "name", "created", "modified", "nativeIdentity", "description", "environment", "hostname", "os", "email", "sentinelVersion", "detectionModuleVersion", "source", "resource", "datasetId", "owners", "connectorAttributes", "attributes") 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 'name' missing." } if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { throw "Error! JSON cannot be serialized due to the required property 'name' missing." } else { $Name = $JsonParameters.PSobject.Properties["name"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) { #optional property not found $Id = $null } else { $Id = $JsonParameters.PSobject.Properties["id"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "created"))) { #optional property not found $Created = $null } else { $Created = $JsonParameters.PSobject.Properties["created"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "modified"))) { #optional property not found $Modified = $null } else { $Modified = $JsonParameters.PSobject.Properties["modified"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "nativeIdentity"))) { #optional property not found $NativeIdentity = $null } else { $NativeIdentity = $JsonParameters.PSobject.Properties["nativeIdentity"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "description"))) { #optional property not found $Description = $null } else { $Description = $JsonParameters.PSobject.Properties["description"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "environment"))) { #optional property not found $Environment = $null } else { $Environment = $JsonParameters.PSobject.Properties["environment"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "hostname"))) { #optional property not found $Hostname = $null } else { $Hostname = $JsonParameters.PSobject.Properties["hostname"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "os"))) { #optional property not found $Os = $null } else { $Os = $JsonParameters.PSobject.Properties["os"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "email"))) { #optional property not found $Email = $null } else { $Email = $JsonParameters.PSobject.Properties["email"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "sentinelVersion"))) { #optional property not found $SentinelVersion = $null } else { $SentinelVersion = $JsonParameters.PSobject.Properties["sentinelVersion"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "detectionModuleVersion"))) { #optional property not found $DetectionModuleVersion = $null } else { $DetectionModuleVersion = $JsonParameters.PSobject.Properties["detectionModuleVersion"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "source"))) { #optional property not found $Source = $null } else { $Source = $JsonParameters.PSobject.Properties["source"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "resource"))) { #optional property not found $Resource = $null } else { $Resource = $JsonParameters.PSobject.Properties["resource"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "datasetId"))) { #optional property not found $DatasetId = $null } else { $DatasetId = $JsonParameters.PSobject.Properties["datasetId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "owners"))) { #optional property not found $Owners = $null } else { $Owners = $JsonParameters.PSobject.Properties["owners"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "connectorAttributes"))) { #optional property not found $ConnectorAttributes = $null } else { $ConnectorAttributes = $JsonParameters.PSobject.Properties["connectorAttributes"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "attributes"))) { #optional property not found $Attributes = $null } else { $Attributes = $JsonParameters.PSobject.Properties["attributes"].value } $PSO = [PSCustomObject]@{ "id" = ${Id} "name" = ${Name} "created" = ${Created} "modified" = ${Modified} "nativeIdentity" = ${NativeIdentity} "description" = ${Description} "environment" = ${Environment} "hostname" = ${Hostname} "os" = ${Os} "email" = ${Email} "sentinelVersion" = ${SentinelVersion} "detectionModuleVersion" = ${DetectionModuleVersion} "source" = ${Source} "resource" = ${Resource} "datasetId" = ${DatasetId} "owners" = ${Owners} "connectorAttributes" = ${ConnectorAttributes} "attributes" = ${Attributes} } return $PSO } } |