Public/Get-EventCollection.ps1
# Code generated from specification version 1.0.0: DO NOT EDIT Function Get-EventCollection { <# .SYNOPSIS Get a collection of events based on filter parameters .DESCRIPTION Get a collection of events based on filter parameters .EXAMPLE PS> Get-EventCollection -Type "my_CustomType2" -DateFrom "-10d" Get events with type 'my_CustomType' that were created in the last 10 days .EXAMPLE PS> Get-EventCollection -Device $Device.id Get events from a device .EXAMPLE PS> Get-DeviceCollection -Name $Device.name | Get-EventCollection Get events from a device (using pipeline) #> [cmdletbinding(SupportsShouldProcess = $true, PositionalBinding=$true, HelpUri='', ConfirmImpact = 'None')] [Alias()] [OutputType([object])] Param( # Device ID [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [object[]] $Device, # Event type. [Parameter()] [string] $Type, # Fragment name from event. [Parameter()] [string] $FragmentType, # Start date or date and time of event occurrence. [Parameter()] [string] $DateFrom, # End date or date and time of event occurrence. [Parameter()] [string] $DateTo, # Return the newest instead of the oldest events. Must be used with dateFrom and dateTo parameters [Parameter()] [switch] $Revert, # Maximum number of results [Parameter()] [AllowNull()] [AllowEmptyString()] [ValidateRange(1,2000)] [int] $PageSize, # Include total pages statistic [Parameter()] [switch] $WithTotalPages, # Include all results [Parameter()] [switch] $IncludeAll, # Include raw response including pagination information [Parameter()] [switch] $Raw, # Outputfile [Parameter()] [string] $OutputFile, # NoProxy [Parameter()] [switch] $NoProxy, # Session path [Parameter()] [string] $Session ) Begin { $Parameters = @{} if ($PSBoundParameters.ContainsKey("Type")) { $Parameters["type"] = $Type } if ($PSBoundParameters.ContainsKey("FragmentType")) { $Parameters["fragmentType"] = $FragmentType } if ($PSBoundParameters.ContainsKey("DateFrom")) { $Parameters["dateFrom"] = $DateFrom } if ($PSBoundParameters.ContainsKey("DateTo")) { $Parameters["dateTo"] = $DateTo } if ($PSBoundParameters.ContainsKey("Revert")) { $Parameters["revert"] = $Revert } if ($PSBoundParameters.ContainsKey("PageSize")) { $Parameters["pageSize"] = $PageSize } if ($PSBoundParameters.ContainsKey("WithTotalPages") -and $WithTotalPages) { $Parameters["withTotalPages"] = $WithTotalPages } if ($PSBoundParameters.ContainsKey("OutputFile")) { $Parameters["outputFile"] = $OutputFile } if ($PSBoundParameters.ContainsKey("NoProxy")) { $Parameters["noProxy"] = $NoProxy } if ($PSBoundParameters.ContainsKey("Session")) { $Parameters["session"] = $Session } } Process { $Parameters["device"] = PSc8y\Expand-Id $Device if (!$Force -and !$WhatIfPreference -and !$PSCmdlet.ShouldProcess( (PSc8y\Get-C8ySessionProperty -Name "tenant"), (Format-ConfirmationMessage -Name $PSCmdlet.MyInvocation.InvocationName -InputObject $item) )) { continue } Invoke-Command ` -Noun "events" ` -Verb "list" ` -Parameters $Parameters ` -Type "application/vnd.com.nsn.cumulocity.eventCollection+json" ` -ItemType "application/vnd.com.nsn.cumulocity.event+json" ` -ResultProperty "events" ` -Raw:$Raw ` -IncludeAll:$IncludeAll } End {} } |