Skip to content

Commit

Permalink
Version 2.1.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
lwhitelock committed Dec 24, 2021
1 parent 572600a commit 8bf5f53
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
2 changes: 1 addition & 1 deletion HuduAPI.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = '.\HuduAPI.psm1'

# Version number of this module.
ModuleVersion = '2.0.0'
ModuleVersion = '2.1.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
33 changes: 30 additions & 3 deletions Public/New-HuduAsset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 29 additions & 3 deletions Public/Set-HuduAsset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8bf5f53

Please sign in to comment.