Public/FSLogix.ps1
Function Get-NmeFslogixProfile { <# .SYNOPSIS Get list of all managed FSLogix Profiles. .DESCRIPTION Get list of all managed FSLogix Profiles. This function calls the /api/v1/fslogix endpoint of the NME REST API, using the get method. #> [CmdletBinding()] Param( ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/fslogix$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeFsLogixParamsRest_GET') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeFslogixProfile { <# .SYNOPSIS Create a new FSLogix profile with certain parameters. .DESCRIPTION Create a new FSLogix profile with certain parameters. This function calls the /api/v1/fslogix endpoint of the NME REST API, using the post method. .PARAMETER NmeFsLogixParamsRest_POST Requires an NmeFsLogixParamsRest_POST object, as generated by the New-NmeFsLogixParamsRest_POST command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeFsLogixParamsRest_POST"){$true} else{throw " is not a NmeFsLogixParamsRest_POST object."}})]$NmeFsLogixParamsRest_POST ) Set-NmeAuthHeaders Try { $json = $NmeFsLogixParamsRest_POST | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/fslogix$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeFsLogixParamsRest_GET') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeFslogixProfileById { <# .SYNOPSIS Update FSLogix profile. .DESCRIPTION Update FSLogix profile. This function calls the /api/v1/fslogix/{id} endpoint of the NME REST API, using the patch method. .PARAMETER Id ID of scripted Action .PARAMETER NmeFsLogixParamsRest_PATCH Requires an NmeFsLogixParamsRest_PATCH object, as generated by the New-NmeFsLogixParamsRest_PATCH command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeFsLogixParamsRest_PATCH"){$true} else{throw " is not a NmeFsLogixParamsRest_PATCH object."}})]$NmeFsLogixParamsRest_PATCH ) Set-NmeAuthHeaders Try { $json = $NmeFsLogixParamsRest_PATCH | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/fslogix/$Id$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeFsLogixParamsRest_GET') $Result | Add-Member -NotePropertyName 'id' -NotePropertyValue $id -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Remove-NmeFslogixProfileById { <# .SYNOPSIS Delete FSLogix profile. .DESCRIPTION Delete FSLogix profile. This function calls the /api/v1/fslogix/{id} endpoint of the NME REST API, using the delete method. .PARAMETER Id ID of scripted Action #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/fslogix/$Id$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |