public/Market/Read-Market.ps1
using module '..\..\modules\Enums.psm1' using module '..\..\modules\Helper\DateTimeHelper.psm1' using module '..\..\modules\Session.psd1' function Read-Market{ [Alias('rdmr')] param( [Parameter(Mandatory=$true)] # Audit log source file from where the messages will be loaded. [SOURCE] $source, # Id of the searched scope. [string[]] $id, # Where the appointed marketId should be searched as: # * internalId - regular marketId used in the appointed source # * externalId - reference for the externalId, the one participated in this log from lower level # * typeId - used at some adapters when there is generalization of the marketId's typically as certain blueprint type. # # Default value is id. [SEARCH_SCOPE] $searchScope, # Sarch scope of internal ID's [string[]] $internalId, # Sarch scope of super ID's [string[]] $typeId, # Sarch scope of external ID's [string[]] $externalId, # Referent message time taken as baseline from where the messages will be start analyzing. [string] $referentTime, # Timeframe in which the messages will be analyzed after the referent time. [string] $timeSpan, # Additional tracing details which could be used. For markets all values are allowed: Competitors, Producers, Outcomes and Competitors. [TRACE[]] $trace, # If the tracing is requested for Outcomes, this could filter down the wanted outcomeId [string] $outcomeId, # Aggregate state of the item [switch] $aggregate, # Displayed progress message [string] $progressMessage, # provide the result as native object rather than display one [switch] $asObject ) $params = @{} #region Validation if ([Session]::activeSessions.Count -eq 0){ Write-Error 'There is no active session. Import audit logs before they are analyzed.' return } if ($id -and $searchScope){ if ($internalId -or $externalId -or $typeId) { Write-Error 'Ambiquous input parameters, use either id with searchScope, or one of other id''s.' return } } elseif (($internalId -and ($externalId -or $typeId)) -or ($externalId -and ($internalId -or $typeId)) -or ($typeId -and ($externalId -or $externalId))) { Write-Error 'Ambiquous input parameters, use only one of input id''s.' return } else { if ($internalId) { $id = $internalId $searchScope = [SEARCH_SCOPE]::internalId $internalId = $null } elseif ($externalId) { $id = $externalId $searchScope = [SEARCH_SCOPE]::externalId $externalId = $null } elseif ($typeId) { $id = $typeId $searchScope = [SEARCH_SCOPE]::typeId $typeId = $null } } #endregion if ([TRACE]::Outcomes -in $trace) { $_dataType = [DATATYPE]::Outcome } else{ $_dataType = [DATATYPE]::Market } if ($id) { $params.add('id', $id) } if ($searchScope) { $params.add('searchScope', $searchScope) } $params.add('dataType', $_dataType) $params.add('source', $source) if ($referentTime) { $params.add('referentTime', $referentTime) } if ($timeSpan) { $params.add('timeSpan', $timeSpan) } if ($trace) { $params.add('trace', $trace) } if ($outcomeId) { $params.add('outcomeId', $outcomeId) } if ($internal) { $params.add('internal', $internal) } if ($aggregate) { $params.add('aggregate', $aggregate) } if ($progressMessage) { $params.add('progressMessage', $progressMessage) } if ($asObject) { $params.add('asObject', $asObject) } Read-RawLog @params } |