Model/SyncJobMetricsInfo.ps1
|
# # Cloud Governance Api # Contact: support@avepoint.com # <# SyncJobMetricsInfo<PSCustomObject> #> function New-SyncJobMetricsInfo { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ObjectId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ObjectUrl}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ObjectName}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[System.DateTime]] ${TriggerTime}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsRestoredFromRecycleBin} = $false ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => SyncJobMetricsInfo' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "ObjectId" = ${ObjectId} "ObjectUrl" = ${ObjectUrl} "ObjectName" = ${ObjectName} "TriggerTime" = ${TriggerTime} "IsRestoredFromRecycleBin" = ${IsRestoredFromRecycleBin} } return $PSO } } <# SyncJobMetricsInfo<PSCustomObject> #> function ConvertFrom-JsonToSyncJobMetricsInfo { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => SyncJobMetricsInfo' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SyncJobMetricsInfo $AllProperties = $("ObjectId", "ObjectUrl", "ObjectName", "TriggerTime", "IsRestoredFromRecycleBin") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectId"))) { #optional property not found $ObjectId = $null } else { $ObjectId = $JsonParameters.PSobject.Properties["ObjectId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectUrl"))) { #optional property not found $ObjectUrl = $null } else { $ObjectUrl = $JsonParameters.PSobject.Properties["ObjectUrl"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ObjectName"))) { #optional property not found $ObjectName = $null } else { $ObjectName = $JsonParameters.PSobject.Properties["ObjectName"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "TriggerTime"))) { #optional property not found $TriggerTime = $null } else { $TriggerTime = $JsonParameters.PSobject.Properties["TriggerTime"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsRestoredFromRecycleBin"))) { #optional property not found $IsRestoredFromRecycleBin = $null } else { $IsRestoredFromRecycleBin = $JsonParameters.PSobject.Properties["IsRestoredFromRecycleBin"].value } $PSO = [PSCustomObject]@{ "ObjectId" = ${ObjectId} "ObjectUrl" = ${ObjectUrl} "ObjectName" = ${ObjectName} "TriggerTime" = ${TriggerTime} "IsRestoredFromRecycleBin" = ${IsRestoredFromRecycleBin} } return $PSO } } |