exports/Set-SysManTool.ps1

<#
.Synopsis

.Description

.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/set-sysmantool
#>

function Set-SysManTool {
[OutputType('SysMan.Powershell.Models.ITool', 'SysMan.Powershell.Models.IApiErrorMessage')]
[CmdletBinding(DefaultParameterSetName='Put', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
    [Parameter(Mandatory, HelpMessage='The id of the tool to update')]
    [SysMan.Powershell.Category('Path')]
    [System.String]
    ${Id},

    [Parameter(ParameterSetName='Put', ValueFromPipeline, HelpMessage='Represent a tool that can be executed by a user')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.ITool]
    ${ToolToUpdate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date the tool was created')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${CreatedDate},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='Custom Variables')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.IToolCustomParameter[]]
    ${CustomParameters},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='A description over the tool that explains what is does. Often displayed to users.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Description},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The id')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Id1},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the tool is enabled or not. A tool that is not enabled cannot be executed and will not be shown to the user')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${IsEnabled},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the tool is marked as favorite or not. A tool that is marked as favorite will be visible on the workplace pagein SysMan.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${IsFavorite},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the tool should be executed on the server or the client.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${IsServer},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the tool is a system tool or not. System tool are managed by SysMan and can only be enabled or disabled.')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${IsSystem},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The last person who modified the tool')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${LastModifiedBy},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The date the tool was last modified')]
    [SysMan.Powershell.Category('Body')]
    [System.DateTime]
    ${LastModifiedDate},

    [Parameter(ParameterSetName='PutExpanded', Mandatory, HelpMessage='The name of the tool. Usually used to display the tool the user')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Name},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='If the tool will need a verification from the user or not (only works for UI clients)')]
    [SysMan.Powershell.Category('Body')]
    [System.Boolean]
    ${NeedVerification},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The path to the script file (if IsServer is true) or the command line that will be used to execute the tool locally(if IsServer is false)')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Path},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The result this tool expect to return')]
    [SysMan.Powershell.Category('Body')]
    [System.Int32]
    ${ResultType},

    [Parameter(ParameterSetName='PutExpanded', HelpMessage='The text to show to the (UI) client')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${VerificationText},

    [Parameter(DontShow, HelpMessage='Wait for .NET debugger to attach')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    ${Break},

    [Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be appended to the front of the pipeline')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [SysMan.Powershell.Runtime.SendAsyncStep[]]
    ${HttpPipelineAppend},

    [Parameter(DontShow, HelpMessage='SendAsync Pipeline Steps to be prepended to the front of the pipeline')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [SysMan.Powershell.Runtime.SendAsyncStep[]]
    ${HttpPipelinePrepend},

    [Parameter(DontShow, HelpMessage='The URI for the proxy server to use')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Uri]
    ${Proxy},

    [Parameter(DontShow, HelpMessage='Credentials for a proxy server to use for the remote call')]
    [ValidateNotNull()]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.PSCredential]
    ${ProxyCredential},

    [Parameter(DontShow, HelpMessage='Use the default credentials for the proxy')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    ${ProxyUseDefaultCredentials}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PsCmdlet.ParameterSetName
        $mapping = @{
            Put = 'SysMan.WebApi.private\Set-SysManTool_Put';
            PutExpanded = 'SysMan.WebApi.private\Set-SysManTool_PutExpanded';
        }
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
        $scriptCmd = {& $wrappedCmd @PSBoundParameters}
        $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
        $steppablePipeline.Begin($PSCmdlet)
    } catch {
        throw
    }
}

process {
    try {
        $steppablePipeline.Process($_)
    } catch {
        throw
    }
}

end {
    try {
        $steppablePipeline.End()
    } catch {
        throw
    }
}
}