From 8bf5f53f7d3a08c5392cf4281ffed97968e4f6b8 Mon Sep 17 00:00:00 2001 From: lwhitelock <79275328+lwhitelock@users.noreply.github.com> Date: Fri, 24 Dec 2021 09:43:48 +0000 Subject: [PATCH] Version 2.1.0 Release --- HuduAPI.psd1 | 2 +- Public/New-HuduAsset.ps1 | 33 ++++++++++++++++++++++++++++++--- Public/Set-HuduAsset.ps1 | 32 +++++++++++++++++++++++++++++--- README.md | 6 +++++- 4 files changed, 65 insertions(+), 8 deletions(-) diff --git a/HuduAPI.psd1 b/HuduAPI.psd1 index f39888f..8bacc1e 100644 --- a/HuduAPI.psd1 +++ b/HuduAPI.psd1 @@ -12,7 +12,7 @@ RootModule = '.\HuduAPI.psm1' # Version number of this module. - ModuleVersion = '2.0.0' + ModuleVersion = '2.1.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/Public/New-HuduAsset.ps1 b/Public/New-HuduAsset.ps1 index 2d23da0..37f8027 100644 --- a/Public/New-HuduAsset.ps1 +++ b/Public/New-HuduAsset.ps1 @@ -9,15 +9,42 @@ function New-HuduAsset { [Alias("asset_layout_id")] [Parameter(Mandatory = $true)] [Int]$AssetLayoutId, - [Parameter(Mandatory = $true)] - [Array]$Fields + [Array]$Fields, + [Alias("primary_serial")] + [string]$PrimarySerial, + [Alias("primary_mail")] + [string]$PrimaryMail, + [Alias("primary_model")] + [string]$PrimaryModel, + [Alias("primary_manufacturer")] + [string]$PrimaryManufacturer ) $Asset = [ordered]@{asset = [ordered]@{} } $Asset.asset.add('name', $Name) $Asset.asset.add('asset_layout_id', $AssetLayoutId) - $Asset.asset.add('custom_fields', $Fields) + + + if ($PrimarySerial) { + $Asset.asset.add('primary_serial', $PrimarySerial) + } + + if ($PrimaryMail) { + $Asset.asset.add('primary_mail', $PrimaryMail) + } + + if ($PrimaryModel) { + $Asset.asset.add('primary_model', $PrimaryModel) + } + + if ($PrimaryManufacturer) { + $Asset.asset.add('primary_manufacturer', $PrimaryManufacturer) + } + + if ($Fields) { + $Asset.asset.add('custom_fields', $Fields) + } $JSON = $Asset | convertto-json -Depth 10 diff --git a/Public/Set-HuduAsset.ps1 b/Public/Set-HuduAsset.ps1 index 96f4481..19deba5 100644 --- a/Public/Set-HuduAsset.ps1 +++ b/Public/Set-HuduAsset.ps1 @@ -9,18 +9,44 @@ function Set-HuduAsset { [Alias("asset_layout_id")] [Parameter(Mandatory = $true)] [Int]$AssetLayoutId, - [Parameter(Mandatory = $true)] [Array]$Fields, [Alias("asset_id")] [Parameter(Mandatory = $true)] - [Int]$AssetId + [Int]$AssetId, + [Alias("primary_serial")] + [string]$PrimarySerial, + [Alias("primary_mail")] + [string]$PrimaryMail, + [Alias("primary_model")] + [string]$PrimaryModel, + [Alias("primary_manufacturer")] + [string]$PrimaryManufacturer ) $Asset = [ordered]@{asset = [ordered]@{} } $Asset.asset.add('name', $Name) $Asset.asset.add('asset_layout_id', $AssetLayoutId) - $Asset.asset.add('custom_fields', $Fields) + + if ($PrimarySerial) { + $Asset.asset.add('primary_serial', $PrimarySerial) + } + + if ($PrimaryMail) { + $Asset.asset.add('primary_mail', $PrimaryMail) + } + + if ($PrimaryModel) { + $Asset.asset.add('primary_model', $PrimaryModel) + } + + if ($PrimaryManufacturer) { + $Asset.asset.add('primary_manufacturer', $PrimaryManufacturer) + } + + if ($Fields) { + $Asset.asset.add('custom_fields', $Fields) + } $JSON = $Asset | ConvertTo-Json -Depth 10 diff --git a/README.md b/README.md index 65857ff..d17f61b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ ## Release Notes - +### Version 2.1. +``` +Added the ability to set primary_serial, primary_mail, primary_model, primary_manufacturer to New-HuduAsset and Set-HuduAsset +Set fields to be optional for New-HuduAsset and Set-HuduAsset +``` ### Version 2.0.0-alpha1 Added Get-HuduProcesses ### Version 2.0.0-alpha