mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
set-snipeitstatus
This commit is contained in:
parent
e8d52ab59c
commit
3a0b1d853a
2 changed files with 113 additions and 23 deletions
83
SnipeitPS/Public/Set-SnipeitStatus.ps1
Normal file
83
SnipeitPS/Public/Set-SnipeitStatus.ps1
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Sets Snipe-it Status Labels
|
||||
|
||||
.PARAMETER id
|
||||
A id of specific Status Label
|
||||
|
||||
|
||||
.PARAMETER color
|
||||
Hex code showing what color the status label should be on the pie chart in the dashboard
|
||||
|
||||
.PARAMETER show_in_nav
|
||||
1 or 0 - determine whether the status label should show in the left-side nav of the web GUI
|
||||
|
||||
.PARAMETER default_label
|
||||
1 or 0 - determine whether it should be bubbled up to the top of the list of available statuses
|
||||
|
||||
.PARAMETER url
|
||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
||||
|
||||
.PARAMETER apiKey
|
||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
||||
|
||||
.EXAMPLE
|
||||
Get-SnipeitStatus -search "Ready to Deploy"
|
||||
|
||||
.EXAMPLE
|
||||
Set-SnipeitStatus -id 3 -name 'Waiting for arrival' -type pending
|
||||
|
||||
#>
|
||||
|
||||
function Set-SnipeitStatus()
|
||||
{
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess = $true,
|
||||
ConfirmImpact = "Medium"
|
||||
)]
|
||||
Param(
|
||||
[parameter(Mandatory=$true,ValueFromPipelineByPropertyName)]
|
||||
[int[]]$id,
|
||||
|
||||
[string]$name,
|
||||
|
||||
[parameter(Mandatory=$true)]
|
||||
[ValidateSet('deployable','undeployable','pending','archived')]
|
||||
[string]$type,
|
||||
|
||||
[string]$notes,
|
||||
|
||||
[string]$color,
|
||||
|
||||
[bool]$show_in_nav,
|
||||
|
||||
[bool]$default_label,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$url,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$apiKey
|
||||
)
|
||||
|
||||
begin {
|
||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||
$Body = $Values | ConvertTo-Json
|
||||
}
|
||||
|
||||
process {
|
||||
foreach($status_id in $id) {
|
||||
$Parameters = @{
|
||||
Uri = "$url/api/v1/statuslabels/$status_id"
|
||||
Method = 'Put'
|
||||
Body = $Body
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||
$result = Invoke-SnipeitMethod @Parameters
|
||||
}
|
||||
$result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -70,6 +70,9 @@ PowerShellVersion = '3.0'
|
|||
|
||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||
FunctionsToExport = @(
|
||||
'Get-SnipeitAccessory',
|
||||
'Get-SnipeitAccessoryOwner',
|
||||
'Get-SnipeitActivity',
|
||||
'Get-SnipeitAsset',
|
||||
'Get-SnipeitAssetMaintenance',
|
||||
'Get-SnipeitCategory',
|
||||
|
|
@ -78,45 +81,30 @@ FunctionsToExport = @(
|
|||
'Get-SnipeitCustomField',
|
||||
'Get-SnipeitDepartment',
|
||||
'Get-SnipeitFieldset',
|
||||
'Get-SnipeitLicense',
|
||||
'Get-SnipeitLicenseSeat',
|
||||
'Get-SnipeitLocation',
|
||||
'Get-SnipeitManufacturer',
|
||||
'Get-SnipeitModel',
|
||||
'Get-SnipeitStatus',
|
||||
'Get-SnipeitSupplier',
|
||||
'Get-SnipeitUser',
|
||||
'New-SnipeitAccessory',
|
||||
'New-SnipeitAsset',
|
||||
'New-SnipeitAssetMaintenance',
|
||||
'New-SnipeItAudit',
|
||||
'New-SnipeitCategory',
|
||||
'New-SnipeitComponent',
|
||||
'New-SnipeitCustomField',
|
||||
'New-SnipeitDepartment',
|
||||
'New-SnipeitLicense',
|
||||
'Set-SnipeitLicense',
|
||||
'Get-SnipeitLicense',
|
||||
'Get-SnipeitLicenseSeat',
|
||||
'Set-SnipeitLicenseSeat',
|
||||
'New-SnipeitLocation',
|
||||
'New-SnipeitManufacturer',
|
||||
'New-SnipeitModel',
|
||||
'New-SnipeitUser',
|
||||
'Set-SnipeitAsset',
|
||||
'Set-SnipeitAssetOwner',
|
||||
'Set-SnipeitComponent',
|
||||
'Set-SnipeitModel',
|
||||
'Set-SnipeitInfo',
|
||||
'Set-SnipeitUser',
|
||||
'Set-SnipeitLocation',
|
||||
'Add-SnipeitAccessory',
|
||||
'Set-SnipeitAccessory',
|
||||
'Get-SnipeitAccessory',
|
||||
'Remove-SnipeitAsset',
|
||||
'Remove-SnipeitUser',
|
||||
'Update-SnipeitAlias',
|
||||
'Set-SnipeitAccessoryOwner',
|
||||
'Get-SnipeitAccessoryOwner',
|
||||
'Reset-SnipeitAccessoryOwner',
|
||||
'Get-SnipeitActivity',
|
||||
'Remove-SnipeitAccessory',
|
||||
'Remove-SnipeitAsset',
|
||||
'Remove-SnipeitAssetMaintenance',
|
||||
'Remove-SnipeitCategory',
|
||||
'Remove-SnipeitCompany',
|
||||
'Remove-SnipeitComponent',
|
||||
|
|
@ -125,8 +113,27 @@ FunctionsToExport = @(
|
|||
'Remove-SnipeitLicense',
|
||||
'Remove-SnipeitLocation',
|
||||
'Remove-SnipeitManufacturer',
|
||||
'Remove-SnipeitModel'
|
||||
|
||||
'Remove-SnipeitModel',
|
||||
'Remove-SnipeitUser',
|
||||
'Reset-SnipeitAccessoryOwner',
|
||||
'Reset-SnipeitAssetOwner',
|
||||
'Set-SnipeitAccessory',
|
||||
'Set-SnipeitAccessoryOwner',
|
||||
'Set-SnipeitAsset',
|
||||
'Set-SnipeitAssetOwner',
|
||||
'Set-SnipeitCategory'
|
||||
'Set-SnipeitCompany'
|
||||
'Set-SnipeitComponent',
|
||||
'Set-SnipeitCustomField',
|
||||
'Set-SnipeitDepartment',
|
||||
'Set-SnipeitInfo',
|
||||
'Set-SnipeitLicense',
|
||||
'Set-SnipeitLicenseSeat',
|
||||
'Set-SnipeitLocation',
|
||||
'Set-SnipeitModel',
|
||||
'Set-SnipeitStatus',
|
||||
'Set-SnipeitUser',
|
||||
'Update-SnipeitAlias'
|
||||
)
|
||||
|
||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue