Public/New-Scaler.ps1
<# .SYNOPSIS Creates an scalar object. .DESCRIPTION Creates the scalar JSON message in hashtable form to send to the eCC Salesforce API to accept measurements .INPUTS None. You cannot pipe objects to New-Scalar. .OUTPUTS A new PSCustomObject that contains the scalar data .PARAMETER MetricTypeCode The metric type code from the org metrics. See Get-MetricDefinitions .PARAMETER UnitTypeCode The unit type code from the org metrics. See Get-MetricDefinitions .PARAMETER Value The value in units specified by UnitTypeCode .PARAMETER DateTime The date/time of the scalar measurement. #> function New-Scalar { [CmdletBinding()] [OutputType([PSCustomObject])] param( [Parameter(Mandatory = $true, Position = 0)] [ValidateNotNullOrEmpty()] [String] $MetricTypeCode, [Parameter(Mandatory = $true, Position = 1)] [String] $UnitTypeCode, [Parameter(Mandatory = $true, Position = 2)] [String] $Value, [Parameter(Mandatory = $true, Position = 3)] [System.DateTime] $DateTime ) begin { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" } end { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" } process { Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)" Write-Output @{ "attributes" = @{ "type" = "Scalar__c" } "Metric_Type_Code__c" = $MetricTypeCode "Value__c" = $Value "Unit_Type_Code__c" = $UnitTypeCode "Observation_Date_Time__c" = $DateTime "Observation_Result_Status__c" = "R" "Observation_Method__c" = "AMEAS^auto-measurement^MDC" } } } |