Public/Set-MerakiNetworkFirmwareUpgradesStagedEvent.ps1

function Set-MerakiNetworkFirmwareUpgradesStagedEvent {
    <#
    .SYNOPSIS
    Updates the firmware upgrade stages for a Meraki network using the Meraki Dashboard API.
 
    .DESCRIPTION
    The Set-MerakiNetworkFirmwareUpgradesStagedEvent function allows you to update the firmware upgrade stages for a specified Meraki network by providing the authentication token, network ID, and a firmware staged event configuration string.
 
    .PARAMETER AuthToken
    The authentication token (API key) required to access the Meraki Dashboard API.
 
    .PARAMETER NetworkId
    The ID of the Meraki network for which you want to update the firmware upgrade stages.
 
    .PARAMETER FirmwareStagedEventConfig
    A string containing the firmware staged event configuration. The string should be in JSON format and should include the "stages", "group", "id", "milestones", and "scheduledFor" properties.
 
    .EXAMPLE
    $config = [PSCustomObject]@{
        "stages" = @(
            [PSCustomObject]@{
                "group" = @{
                    "id" = "1234"
                }
                "milestones" = @{
                    "scheduledFor" = "2018-02-11T00:00:00Z"
                }
            }
        )
    }
 
    $config = $config | ConvertTo-Json -Compress
    Set-MerakiNetworkFirmwareUpgradesStagedEvent -AuthToken "your-api-token" -NetworkId "L_123456789012345678" -FirmwareStagedEventConfig $config
 
    This example updates the firmware upgrade stages for the Meraki network with ID "L_123456789012345678", setting the upgrade stages to a single stage with a group ID of "1234" and a scheduled start time of February 11, 2018 at 12:00 AM UTC.
 
    .NOTES
    The function requires the "Invoke-RestMethod" cmdlet to be available.
 
    The function returns the response from the API if the firmware staged event update is successful, otherwise, it displays an error message.
    #>


    [CmdletBinding()]
    param (
        [parameter(Mandatory=$true)]
        [string]$AuthToken,
        [parameter(Mandatory=$true)]
        [string]$NetworkId,
        [parameter(Mandatory=$true)]
        [string]$FirmwareStagedEventConfig
    )
    try {
        $header = @{
            "X-Cisco-Meraki-API-Key" = $AuthToken
            "content-type" = "application/json; charset=utf-8"
        }

        $body = $FirmwareStagedEventConfig

        $url = "https://api.meraki.com/api/v1/networks/$NetworkId/firmwareUpgrades/staged/events"

        $response = Invoke-RestMethod -Method Put -Uri $url -headers $header -UserAgent "MerakiPowerShellModule/1.0.8 DocNougat" -Body $body
        return $response
    }
    catch {
        Write-Debug $_
        Throw $_
    }
}