Public/Set-DattoSaasSeatAssignment.ps1
|
function Set-DattoSaasSeatAssignment { <# .SYNOPSIS Submits a bulk SaaS Protection seat assignment change. .DESCRIPTION Implements PUT /v1/saas/{saasCustomerId}/{externalSubscriptionId}/bulkSeatChange using the exact seat_type, action_type, and ids request fields from the supplied contract. PUT requests are not automatically retried by this cmdlet. .PARAMETER SaasCustomerId The SaaS Protection customer ID. .PARAMETER ExternalSubscriptionId The customer's external subscription ID. .PARAMETER SeatType User, SharedMailbox, Site, TeamSite, SharedDrive, or Team. .PARAMETER ActionType License, Unlicense, or Pause. .PARAMETER Id The remote IDs to change. .PARAMETER Connection A connection object, name, or ID. .EXAMPLE Set-DattoSaasSeatAssignment -SaasCustomerId 53124 -ExternalSubscriptionId 'Classic:Office365:123456' -SeatType User -ActionType License -Id 'id-1','id-2' -WhatIf #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] param( [Parameter(Mandatory)][ValidateRange(1, [int]::MaxValue)][int]$SaasCustomerId, [Parameter(Mandatory)][ValidateNotNullOrEmpty()][string]$ExternalSubscriptionId, [Parameter(Mandatory)][ValidateSet('User', 'SharedMailbox', 'Site', 'TeamSite', 'SharedDrive', 'Team')][string]$SeatType, [Parameter(Mandatory)][ValidateSet('License', 'Unlicense', 'Pause')][string]$ActionType, [Parameter(Mandatory)][ValidateNotNullOrEmpty()][ValidateScript({ foreach ($value in $_) { if ([string]::IsNullOrWhiteSpace([string]$value)) { return $false } }; return $true })][string[]]$Id, [Parameter()][AllowNull()][object]$Connection ) $subscription = ConvertTo-DattoApiPathSegment -Value $ExternalSubscriptionId $target = "SaaS customer $SaasCustomerId, subscription $ExternalSubscriptionId" $action = "$ActionType $($Id.Count) $SeatType seat(s)" if ($PSCmdlet.ShouldProcess($target, $action)) { $body = [ordered]@{ seat_type = $SeatType; action_type = $ActionType; ids = $Id } Invoke-DattoApiRequest -Method PUT -Path "/v1/saas/$SaasCustomerId/$subscription/bulkSeatChange" -Body $body -Connection $Connection } } |