Public-manual/Update-Microservice.ps1
Function Update-Microservice { <# .SYNOPSIS Update microservice application .EXAMPLE PS> Update-Microservice -Id $App.id -File "myapp.zip" Upload application microservice binary #> [cmdletbinding(SupportsShouldProcess = $true, PositionalBinding=$true, HelpUri='', ConfirmImpact = 'High')] [Alias()] [OutputType([object])] Param( # File to be uploaded as a binary (required) [Parameter(Mandatory = $true)] [string] $File, # Application id (required) [Parameter(Mandatory = $false, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [object[]] $Application, # Include raw response including pagination information [Parameter()] [switch] $Raw, # Outputfile [Parameter()] [string] $OutputFile, # NoProxy [Parameter()] [switch] $NoProxy, # Session path [Parameter()] [string] $Session, # Don't prompt for confirmation [Parameter()] [switch] $Force ) Begin { $Parameters = @{} if ($PSBoundParameters.ContainsKey("File")) { $Parameters["File"] = $File } if ($PSBoundParameters.ContainsKey("OutputFile")) { $Parameters["outputFile"] = $OutputFile } if ($PSBoundParameters.ContainsKey("NoProxy")) { $Parameters["noProxy"] = $NoProxy } if ($PSBoundParameters.ContainsKey("Session")) { $Parameters["session"] = $Session } } Process { # TODO: create Expand-Microservice # TODO: create Get-MicroserviceCollection # TODO: create Get-Microservice foreach ($item in (PSc8y\Expand-Application $Application)) { if ($item) { $Parameters["application"] = if ($item.id) { $item.id } else { $item } } if (!$Force -and !$WhatIfPreference -and !$PSCmdlet.ShouldProcess( (PSc8y\Get-C8ySessionProperty -Name "tenant"), (Format-ConfirmationMessage -Name $PSCmdlet.MyInvocation.InvocationName -InputObject $item) )) { continue } Invoke-Command ` -Noun "microservices" ` -Verb "update" ` -Parameters $Parameters ` -Type "application/vnd.com.nsn.cumulocity.managedObject+json" ` -ItemType "" ` -ResultProperty "" ` -Raw:$Raw } } End {} } |