Changes to fix changes in newer build

This commit is contained in:
Stephen Maunder 2017-12-29 14:06:27 +00:00
parent ebb99a24fa
commit cf23662a42
2 changed files with 18 additions and 3 deletions

View file

@ -62,12 +62,16 @@ function New-Asset()
)
$Values = @{
"asset_tag" = $tag
"name" = $Name
"status_id" = $status_id
"model_id" = $model_id
}
if ($PSBoundParameters.ContainsKey('tag'))
{
$Values += @{"asset_tag" = $tag}
}
if ($customfields)
{
$Values += $customfields

View file

@ -10,7 +10,10 @@ function Set-AssetOwner()
[int]$id,
[parameter(mandatory = $true)]
[int]$user_id,
[int]$assigned_id,
[ValidateSet("location","asset","user")]
[string] $checkout_to_type = "user",
[parameter(mandatory = $true)]
[string]$url,
@ -20,7 +23,15 @@ function Set-AssetOwner()
)
$Values = @{
"user_id" = $user_id
"id" = $assigned_id
"checkout_to_type" = $checkout_to_type
}
switch ($checkout_to_type)
{
'location' { $Values += @{ "assigned_location" = $assigned_id } }
'user' { $Values += @{ "assigned_user" = $assigned_id } }
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
}
$Body = $Values | ConvertTo-Json;