PSc8y.psm1


#########################################################################################
#
# PSc8y Module
#
#########################################################################################

#Microsoft.PowerShell.Core\Set-StrictMode -Version Latest

#region script variables

$script:IsWindows = (-not (Get-Variable -Name IsWindows -ErrorAction Ignore)) -or $IsWindows
$script:IsLinux = (Get-Variable -Name IsLinux -ErrorAction Ignore) -and $IsLinux
$script:IsMacOS = (Get-Variable -Name IsMacOS -ErrorAction Ignore) -and $IsMacOS
$script:IsCoreCLR = $PSVersionTable.ContainsKey('PSEdition') -and $PSVersionTable.PSEdition -eq 'Core'
$script:Dependencies = Join-Path -Path $PSScriptRoot -ChildPath "Dependencies"
$script:Templates = Join-Path -Path $PSScriptRoot -ChildPath "Templates"

#endregion

#region Private Functions
Function Format-CommandParameter {
    [cmdletbinding()]
    Param(
        [Parameter(
            Mandatory = $true,
            Position = 0
        )]
        [object] $ParameterList
    )
    $Parameters = @{}

    $ParameterList = (Get-Command -Name $CommandName).Parameters

    # Grab each parameter value, using Get-Variable
    foreach ($Name in ($ParameterList.Keys -notmatch "^Raw$")) {
        $iParam = Get-Variable -Name $Name -ErrorAction SilentlyContinue;

        if ($iParam.Value -is [Switch]) {
            if ($iParam.Value.IsPresent -and $iParam) {
                $Parameters[$Name] = $true
            }
        } elseif ($iParam.Value -is [hashtable]) {
            $Parameters[$Name] = "{0}" -f ((ConvertTo-Json $iParam.Value -Depth 100 -Compress) -replace '"', '\"')
        } elseif ($iParam.Value -is [datetime]) {
            $Parameters[$Name] = Format-Date $iParam.Value
        } else {
            if ("$iParam" -notmatch "^$") {
                $Parameters[$Name] = $iParam.Value
            }
        }
    }

    $Parameters
}

Function Format-ConfirmationMessage {
<#
.SYNOPSIS
Format the confirmation message from a cmdlet name and input object
#>

    [cmdletbinding()]
    Param(
        [Parameter(
            Mandatory = $true,
            ValueFromPipeline = $true,
            Position = 0)]
        [string] $Name,

        [Parameter(
            Mandatory = $true,
            Position = 1)]
        [AllowNull()]
        [object[]] $inputObject,

        [string] $IgnorePrefix = ""
    )

    Process {
    
        $parts = New-Object System.Collections.ArrayList;

        # Remove fully qualified module name
        $Name = $Name -replace "^\w+\\", ""

        foreach ($item in ($Name -csplit '(?=[A-Z\-])')) {
            if ($item -eq "-" -or $item -eq "" -or $item -eq $IgnorePrefix) {
                continue;
            }
            $item = $item -replace "^-", ""
            if ($parts.Count -eq 0) {
                $null = $parts.Add($item);
            } else {
                $null = $parts.Add("$item".ToLowerInvariant());
            }
        }

        foreach ($item in $inputObject) {
            if ($item -is [string]) {
                if ($item.StartsWith("{")) {
                    $item = ConvertFrom-Json $item -Depth 100 -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
                }
            }
            if ($item.id -and $item.name) {
                $null = $parts.Add(("[{1} ({0})]" -f $item.id, $item.name))
            } elseif ($item.id) {
                $null = $parts.Add(("[{0}]" -f $item.id))
            } elseif ($item) {
                $null = $parts.Add("[{0}]" -f $item)
            } else {
                # Don't add anything
            }
        }

        $parts -join " "
    }
}

Function Get-ClientOutputOption {
    [cmdletbinding()]
    Param(
        
        [Parameter(
            Mandatory = $true,
            Position = 0)]
        [hashtable]
        $BoundParameters
    )

    Process {
        $ConvertToPS = $BoundParameters["AsHashTable"] `
            -or $BoundParameters["AsPSObject"]
        $UsePowershellTypes = $BoundParameters["Select"]

        [PSCustomObject]@{
            ConvertToPS = $ConvertToPS
            UsePowershellTypes = $UsePowershellTypes
        }
    }   
}

Function Get-NestedProperty {
    [cmdletbinding()]
    Param(
        [Parameter(
            Mandatory = $true,
            Position = 0
        )]
        [AllowNull()]
        [AllowEmptyCollection()]
        [object[]] $InputObject,

        [Parameter(
            Mandatory = $true,
            Position = 1
        )]
        [AllowNull()]
        [AllowEmptyString()]
        [string] $Name
    )

    if (!$Name) {
        $null
        return
    }

    $Output = $InputObject

    foreach ($part in ($Name -split "\.")) {
        if ($null -eq $Output.$part -and $null -eq $Output.$part.Count) {
            $Output = $null
            break;
        }
        $Output = $Output.$part
    }
    $Output
}

Function New-ClientArgument {
    <#
    .SYNOPSIS
    Run a Cumulocity client command using the c8y binary. Only intended for internal usage only

    .DESCRIPTION
    The command is a wrapper around the c8y binary which is used to send the rest request to Cumulocity.

    The result will also be parsed, and Powershell type information will be added to the result set, so
    only relevant information is shown.
    #>

    [cmdletbinding()]
    Param(
        # Parameters which should be passed to the c8y binary
        # The full parameter name should be used (i.e. --header, and not -H)
        [hashtable] $Parameters,

        # Command
        [string] $Command,

        # List of names to exclude when parsing the parameters
        [string[]] $Exclude
    )

    Process {

        $c8yargs = New-Object System.Collections.ArrayList
        $BoundParameters = @{} + $Parameters

        # strip automatic variables
        $BoundParameters.Keys -match "(Verbose|WhatIf|WhatIfFormat|Variable|Action|Buffer|Debug|AsHashtable|AsPSObject)$" | ForEach-Object {
            $BoundParameters.Remove($_)
        }

        # Exclude select keys
        if ($Exclude -and $Exclude.Count -gt 0) {
            foreach ($key in (@() + $BoundParameters.Keys)) {
                if ($Exclude -contains $key) {
                    $BoundParameters.Remove($key)
                }
            }
        }

        # A change in powershell handling of quoting was introduced in Powershell >= 7.3
        # This complicates a few things...
        # See issue for more details: https://github.com/PowerShell/PowerShell/issues/18554
        $NeedsQuotes = ($null -eq $PSNativeCommandArgumentPassing) -or ($PSNativeCommandArgumentPassing -ne 'Standard')

        foreach ($iKey in $BoundParameters.Keys) {
            $Value = $BoundParameters[$iKey]

            if ($null -ne $Value) {
                $key = $iKey[0].ToString().ToLowerInvariant() + $iKey.SubString(1)

                switch ($Value) {
                    # boolean
                    { $Value -is [bool] -and $Value } {
                        $null = $c8yargs.AddRange(@("--${key}"))
                        break
                    }

                    { $Value -is [switch] } {
                        if ($Value) {
                            $null = $c8yargs.AddRange(@("--${key}"))
                        } else {
                            $null = $c8yargs.AddRange(@("--${key}=false"))
                        }
                        break
                    }

                    { $Value -is [int] } {
                        $null = $c8yargs.AddRange(@("--${key}=$Value"))
                        break
                    }

                    # json like values
                    { $key -eq "data" -or $Value -is [hashtable] -or $Value -is [PSCustomObject] } {
                        $ArgValue = ConvertTo-JsonArgument $Value
                        # due to cli parsing, data needs to be sent using "="
                        $null = $c8yargs.AddRange(@("--${key}", $ArgValue))
                        break
                    }

                    { $Value -is [array] } {
                        $items = Expand-Id $Value
                        if ($items.Count -eq 1) {

                            $null = $c8yargs.Add("--${key}=$($items -join ',')")

                        } elseif ($items.Count -gt 1) {
                            if ($NeedsQuotes) {
                                $null = $c8yargs.Add("--${key}=`"$($items -join ',')`"")
                            } else {
                                $null = $c8yargs.Add("--${key}=$($items -join ',')")
                            }
                        }
                        break
                    }

                    { $Value -match " " -and ![string]::IsNullOrWhiteSpace($Value) } {
                        if ($NeedsQuotes) {
                            $null = $c8yargs.Add("--${key}=`"$Value`"")
                        } else {
                            $null = $c8yargs.Add("--${key}=$Value")
                        }
                        break
                    }

                    default {
                        if (![string]::IsNullOrWhiteSpace($Value)) {
                            $null = $c8yargs.Add("--${key}=$Value")
                        }
                    }
                }
            }
        }

        if ($DebugPreference -ne "SilentlyContinue") {
            $null = $c8yargs.Add("--debug")
        }

        if (-Not $Parameters.ContainsKey("Dry") -and $WhatIfPreference) {
            $null = $c8yargs.Add("--dry")
        }

        if (-Not $Parameters.ContainsKey("DryFormat") -and $Parameters["WhatIfFormat"]) {
            $null = $c8yargs.Add(("--dryFormat={0}" -f $Parameters["WhatIfFormat"]))
        }

        # Always use verbose as information is extracted from it
        if ($VerbosePreference) {
            $null = $c8yargs.Add("--verbose")
        }

        if ($Parameters["WithTotalPages"] -or $Parameters["WithTotalElements"]) {
            $null = $c8yargs.Add("--raw")
        }

        # Allow empty pipes (only in powershell as it handles empty pipes in the cmdlets)
        # This simplifies logic on the powershell side, rather than dynamically checking if there is really piped
        # input or not
        $null = $c8yargs.Add("--allowEmptyPipe")

        ,$c8yargs
    }
}

Function New-DynamicParam {
    <#
        .SYNOPSIS
            Helper function to simplify creating dynamic parameters
        
        .DESCRIPTION
            Helper function to simplify creating dynamic parameters
    
            Example use cases:
                Include parameters only if your environment dictates it
                Include parameters depending on the value of a user-specified parameter
                Provide tab completion and intellisense for parameters, depending on the environment
    
            Please keep in mind that all dynamic parameters you create will not have corresponding variables created.
               One of the examples illustrates a generic method for populating appropriate variables from dynamic parameters
               Alternatively, manually reference $PSBoundParameters for the dynamic parameter value
    
        .NOTES
            Credit to http://jrich523.wordpress.com/2013/05/30/powershell-simple-way-to-add-dynamic-parameters-to-advanced-function/
                Added logic to make option set optional
                Added logic to add RuntimeDefinedParameter to existing DPDictionary
                Added a little comment based help
    
            Credit to BM for alias and type parameters and their handling
    
        .PARAMETER Name
            Name of the dynamic parameter
    
        .PARAMETER Type
            Type for the dynamic parameter. Default is string
    
        .PARAMETER Alias
            If specified, one or more aliases to assign to the dynamic parameter
    
        .PARAMETER ValidateSet
            If specified, set the ValidateSet attribute of this dynamic parameter
    
        .PARAMETER Mandatory
            If specified, set the Mandatory attribute for this dynamic parameter
    
        .PARAMETER ParameterSetName
            If specified, set the ParameterSet attribute for this dynamic parameter
    
        .PARAMETER Position
            If specified, set the Position attribute for this dynamic parameter
    
        .PARAMETER ValueFromPipelineByPropertyName
            If specified, set the ValueFromPipelineByPropertyName attribute for this dynamic parameter
    
        .PARAMETER HelpMessage
            If specified, set the HelpMessage for this dynamic parameter
        
        .PARAMETER DPDictionary
            If specified, add resulting RuntimeDefinedParameter to an existing RuntimeDefinedParameterDictionary (appropriate for multiple dynamic parameters)
            If not specified, create and return a RuntimeDefinedParameterDictionary (appropriate for a single dynamic parameter)
    
            See final example for illustration
    
        .EXAMPLE
            
            function Show-Free
            {
                [CmdletBinding()]
                Param()
                DynamicParam {
                    $options = @( gwmi win32_volume | %{$_.driveletter} | sort )
                    New-DynamicParam -Name Drive -ValidateSet $options -Position 0 -Mandatory
                }
                begin{
                    #have to manually populate
                    $drive = $PSBoundParameters.drive
                }
                process{
                    $vol = gwmi win32_volume -Filter "driveletter='$drive'"
                    "{0:N2}% free on {1}" -f ($vol.Capacity / $vol.FreeSpace),$drive
                }
            } #Show-Free
    
            Show-Free -Drive <tab>
    
        # This example illustrates the use of New-DynamicParam to create a single dynamic parameter
        # The Drive parameter ValidateSet populates with all available volumes on the computer for handy tab completion / intellisense
    
        .EXAMPLE
    
        # I found many cases where I needed to add more than one dynamic parameter
        # The DPDictionary parameter lets you specify an existing dictionary
        # The block of code in the Begin block loops through bound parameters and defines variables if they don't exist
    
            Function Test-DynPar{
                [cmdletbinding()]
                param(
                    [string[]]$x = $Null
                )
                DynamicParam
                {
                    #Create the RuntimeDefinedParameterDictionary
                    $Dictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
            
                    New-DynamicParam -Name AlwaysParam -ValidateSet @( gwmi win32_volume | %{$_.driveletter} | sort ) -DPDictionary $Dictionary
    
                    #Add dynamic parameters to $dictionary
                    if($x -eq 1)
                    {
                        New-DynamicParam -Name X1Param1 -ValidateSet 1,2 -mandatory -DPDictionary $Dictionary
                        New-DynamicParam -Name X1Param2 -DPDictionary $Dictionary
                        New-DynamicParam -Name X3Param3 -DPDictionary $Dictionary -Type DateTime
                    }
                    else
                    {
                        New-DynamicParam -Name OtherParam1 -Mandatory -DPDictionary $Dictionary
                        New-DynamicParam -Name OtherParam2 -DPDictionary $Dictionary
                        New-DynamicParam -Name OtherParam3 -DPDictionary $Dictionary -Type DateTime
                    }
            
                    #return RuntimeDefinedParameterDictionary
                    $Dictionary
                }
                Begin
                {
                    #This standard block of code loops through bound parameters...
                    #If no corresponding variable exists, one is created
                        #Get common parameters, pick out bound parameters not in that set
                        Function _temp { [cmdletbinding()] param() }
                        $BoundKeys = $PSBoundParameters.keys | Where-Object { (get-command _temp | select -ExpandProperty parameters).Keys -notcontains $_}
                        foreach($param in $BoundKeys)
                        {
                            if (-not ( Get-Variable -name $param -scope 0 -ErrorAction SilentlyContinue ) )
                            {
                                New-Variable -Name $Param -Value $PSBoundParameters.$param
                                Write-Verbose "Adding variable for dynamic parameter '$param' with value '$($PSBoundParameters.$param)'"
                            }
                        }
    
                    #Appropriate variables should now be defined and accessible
                        Get-Variable -scope 0
                }
            }
    
        # This example illustrates the creation of many dynamic parameters using New-DynamicParam
            # You must create a RuntimeDefinedParameterDictionary object ($dictionary here)
            # To each New-DynamicParam call, add the -DPDictionary parameter pointing to this RuntimeDefinedParameterDictionary
            # At the end of the DynamicParam block, return the RuntimeDefinedParameterDictionary
            # Initialize all bound parameters using the provided block or similar code
    
        .FUNCTIONALITY
            PowerShell Language
    
    #>

    param(
        
        [string]
        $Name,
        
        [System.Type]
        $Type = [string],
    
        [string[]]
        $Alias = @(),
    
        [string[]]
        $ValidateSet,
        
        [switch]
        $Mandatory,
        
        [string]
        $ParameterSetName="__AllParameterSets",
        
        [int]
        $Position,
        
        [switch]
        $ValueFromPipelineByPropertyName,
        
        [string]
        $HelpMessage,
    
        [validatescript({
            if(-not ( $_ -is [System.Management.Automation.RuntimeDefinedParameterDictionary] -or -not $_) )
            {
                Throw "DPDictionary must be a System.Management.Automation.RuntimeDefinedParameterDictionary object, or not exist"
            }
            $True
        })]
        $DPDictionary = $false
     
    )
        #Create attribute object, add attributes, add to collection
            $ParamAttr = New-Object System.Management.Automation.ParameterAttribute
            $ParamAttr.ParameterSetName = $ParameterSetName
            if($mandatory)
            {
                $ParamAttr.Mandatory = $True
            }
            if($Position -ne $null)
            {
                $ParamAttr.Position=$Position
            }
            if($ValueFromPipelineByPropertyName)
            {
                $ParamAttr.ValueFromPipelineByPropertyName = $True
            }
            if($HelpMessage)
            {
                $ParamAttr.HelpMessage = $HelpMessage
            }
     
            $AttributeCollection = New-Object 'Collections.ObjectModel.Collection[System.Attribute]'
            $AttributeCollection.Add($ParamAttr)
        
        #param validation set if specified
            if($ValidateSet)
            {
                $ParamOptions = New-Object System.Management.Automation.ValidateSetAttribute -ArgumentList $ValidateSet
                $AttributeCollection.Add($ParamOptions)
            }
    
        #Aliases if specified
            if($Alias.count -gt 0) {
                $ParamAlias = New-Object System.Management.Automation.AliasAttribute -ArgumentList $Alias
                $AttributeCollection.Add($ParamAlias)
            }
    
     
        #Create the dynamic parameter
            $Parameter = New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList @($Name, $Type, $AttributeCollection)
        
        #Add the dynamic parameter to an existing dynamic parameter dictionary, or create the dictionary and add it
            if($DPDictionary)
            {
                $DPDictionary.Add($Name, $Parameter)
            }
            else
            {
                $Dictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
                $Dictionary.Add($Name, $Parameter)
                $Dictionary
            }
    }

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Use-CallerPreference
{
    <#
    .SYNOPSIS
    Sets the PowerShell preference variables in a module's function based on the callers preferences.
 
    .DESCRIPTION
    Script module functions do not automatically inherit their caller's variables, including preferences set by common parameters. This means if you call a script with switches like `-Verbose` or `-WhatIf`, those that parameter don't get passed into any function that belongs to a module.
 
    When used in a module function, `Use-CallerPreference` will grab the value of these common parameters used by the function's caller:
 
     * ErrorAction
     * Debug
     * Confirm
     * InformationAction
     * Verbose
     * WarningAction
     * WhatIf
     
    This function should be used in a module's function to grab the caller's preference variables so the caller doesn't have to explicitly pass common parameters to the module function.
 
    This function is adapted from the [`Get-CallerPreference` function written by David Wyatt](https://gallery.technet.microsoft.com/scriptcenter/Inherit-Preference-82343b9d).
 
    There is currently a [bug in PowerShell](https://connect.microsoft.com/PowerShell/Feedback/Details/763621) that causes an error when `ErrorAction` is implicitly set to `Ignore`. If you use this function, you'll need to add explicit `-ErrorAction $ErrorActionPreference` to every function/cmdlet call in your function. Please vote up this issue so it can get fixed.
 
    .LINK
    about_Preference_Variables
 
    .LINK
    about_CommonParameters
 
    .LINK
    https://gallery.technet.microsoft.com/scriptcenter/Inherit-Preference-82343b9d
 
    .LINK
    http://powershell.org/wp/2014/01/13/getting-your-script-module-functions-to-inherit-preference-variables-from-the-caller/
 
    .EXAMPLE
    Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
 
    Demonstrates how to set the caller's common parameter preference variables in a module function.
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        #[Management.Automation.PSScriptCmdlet]
        # The module function's `$PSCmdlet` object. Requires the function be decorated with the `[CmdletBinding()]` attribute.
        $Cmdlet,

        [Parameter(Mandatory = $true)]
        [Management.Automation.SessionState]
        # The module function's `$ExecutionContext.SessionState` object. Requires the function be decorated with the `[CmdletBinding()]` attribute.
        #
        # Used to set variables in its callers' scope, even if that caller is in a different script module.
        $SessionState
    )

    Set-StrictMode -Version 'Latest'

    # List of preference variables taken from the about_Preference_Variables and their common parameter name (taken from about_CommonParameters).
    $commonPreferences = @{
                              'ErrorActionPreference' = 'ErrorAction';
                              'DebugPreference' = 'Debug';
                              'ConfirmPreference' = 'Confirm';
                              'InformationPreference' = 'InformationAction';
                              'VerbosePreference' = 'Verbose';
                              'WarningPreference' = 'WarningAction';
                              'WhatIfPreference' = 'WhatIf';
                          }

    foreach( $prefName in $commonPreferences.Keys )
    {
        $parameterName = $commonPreferences[$prefName]

        # Don't do anything if the parameter was passed in.
        if( $Cmdlet.MyInvocation.BoundParameters.ContainsKey($parameterName) )
        {
            continue
        }

        $variable = $Cmdlet.SessionState.PSVariable.Get($prefName)
        # Don't do anything if caller didn't use a common parameter.
        if( -not $variable )
        {
            continue
        }

        if( $SessionState -eq $ExecutionContext.SessionState )
        {
            if ($variable.Value -ne "") {
                Set-Variable -Scope 1 -Name $variable.Name -Value $variable.Value -Force -Confirm:$false -WhatIf:$false
            }
        }
        else
        {
            if ($variable.Value -ne "") {
                $SessionState.PSVariable.Set($variable.Name, $variable.Value)
            }
        }
    }

}

#Requires -Version 5.0
<#
    .SYNOPSIS
        Writes messages to the information stream, optionally with
        color when written to the host.
    .DESCRIPTION
        An alternative to Write-Host which will write to the information stream
        and the host (optionally in colors specified) but will honor the
        $InformationPreference of the calling context.
        In PowerShell 5.0+ Write-Host calls through to Write-Information but
        will _always_ treats $InformationPreference as 'Continue', so the caller
        cannot use other options to the preference variable as intended.
    
    .NOTES
        Reference: https://blog.kieranties.com/2018/03/26/write-information-with-colours
#>

Function Write-InformationColored {
    [CmdletBinding()]
    param(
        # Message data
        [Parameter(Mandatory = $true)]
        [Object] $MessageData,

        # Foreground color
        [System.ConsoleColor] $ForegroundColor, # Make sure we use the current colours by default

        # Background color
        [System.ConsoleColor] $BackgroundColor,

        # Do not append a newline character
        [Switch] $NoNewline,

        # Show the information on the host by default. This will set -InformationAction to continue
        # so that the message is displayed on the console
        [switch] $ShowHost,

        # Tags to add to the information
        [string[]] $Tags
    )

    $msg = [System.Management.Automation.HostInformationMessage]@{
        Message         = $MessageData
        ForegroundColor = $ForegroundColor
        BackgroundColor = $BackgroundColor
        NoNewline       = $NoNewline.IsPresent
    }

    $options = @{
        MessageData = $msg
        Tags = $Tags
    }

    if ($ShowHost) {
        $options["InformationAction"] = "Continue"
    }

    Write-Information @options
}

#endregion

#region Public Functions
# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-DeviceChild {
<#
.SYNOPSIS
Assign child

.DESCRIPTION
Assign an existing managed object as a child to an existing managed object

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_children_assign

.EXAMPLE
PS> Add-DeviceChild -Id $software.id -Child $version.id -ChildType addition

Add a related managed object as a child addition to an existing managed object


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id where the child will be assigned to (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Managed object that will be assigned as a child (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Child,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices children assign"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReference+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Child `
            | Group-ClientRequests `
            | c8y devices children assign $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Child `
            | Group-ClientRequests `
            | c8y devices children assign $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-DeviceGroupChild {
<#
.SYNOPSIS
Assign child

.DESCRIPTION
Assign an existing managed object as a child to an existing managed object

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicegroups_children_assign

.EXAMPLE
PS> Add-DeviceGroupChild -Id $software.id -Child $version.id -ChildType addition

Add a related managed object as a child addition to an existing managed object


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id where the child will be assigned to (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Managed object that will be assigned as a child (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Child,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicegroups children assign"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReference+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Child `
            | Group-ClientRequests `
            | c8y devicegroups children assign $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Child `
            | Group-ClientRequests `
            | c8y devicegroups children assign $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-ManagedObjectChild {
<#
.SYNOPSIS
Assign child

.DESCRIPTION
Assign an existing managed object as a child to an existing managed object

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/inventory_children_assign

.EXAMPLE
PS> Add-ManagedObjectChild -Id $software.id -Child $version.id -ChildType addition

Add a related managed object as a child addition to an existing managed object


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id where the child will be assigned to (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Managed object that will be assigned as a child (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Child,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "inventory children assign"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReference+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Child `
            | Group-ClientRequests `
            | c8y inventory children assign $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Child `
            | Group-ClientRequests `
            | c8y inventory children assign $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-RoleToGroup {
<#
.SYNOPSIS
Add role to user group

.DESCRIPTION
Add a role to an existing user group

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/userroles_addRoleToGroup

.EXAMPLE
PS> Add-RoleToGroup -Group "${NamePattern}*" -Role "*ALARM_*"

Add a role to a group using wildcards

.EXAMPLE
PS> Get-RoleCollection -PageSize 100 | Where-Object Name -like "*ALARM*" | Add-RoleToGroup -Group "${NamePattern}*"

Add a role to a group using wildcards (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Group ID (required)
        [Parameter(Mandatory = $true)]
        [object[]]
        $Group,

        # User role id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Role,

        # Tenant
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "userroles addRoleToGroup"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.roleReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Role `
            | Group-ClientRequests `
            | c8y userroles addRoleToGroup $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Role `
            | Group-ClientRequests `
            | c8y userroles addRoleToGroup $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-RoleToUser {
<#
.SYNOPSIS
Add Role to user

.DESCRIPTION
Add a role to an existing user

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/userroles_addRoleToUser

.EXAMPLE
PS> Add-RoleToUser -User $User.id -Role "ROLE_ALARM_READ"

Add a role (ROLE_ALARM_READ) to a user

.EXAMPLE
PS> Add-RoleToUser -User "customUser_*" -Role "*ALARM_*"

Add a role to a user using wildcards

.EXAMPLE
PS> Get-RoleCollection -PageSize 100 | Where-Object Name -like "*ALARM*" | Add-RoleToUser -User "customUser_*"

Add a role to a user using wildcards (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # User prefix or full username (required)
        [Parameter(Mandatory = $true)]
        [object[]]
        $User,

        # User role id
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Role,

        # Tenant
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "userroles addRoleToUser"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.roleReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Role `
            | Group-ClientRequests `
            | c8y userroles addRoleToUser $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Role `
            | Group-ClientRequests `
            | c8y userroles addRoleToUser $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Add-UserToGroup {
<#
.SYNOPSIS
Add user to group

.DESCRIPTION
Add an existing user to a group

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/userreferences_addUserToGroup

.EXAMPLE
PS> Add-UserToGroup -Group $Group.id -User $User.id

Add a user to a user group


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Group ID (required)
        [Parameter(Mandatory = $true)]
        [object[]]
        $Group,

        # User id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $User,

        # Tenant
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "userreferences addUserToGroup"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.userReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $User `
            | Group-ClientRequests `
            | c8y userreferences addUserToGroup $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $User `
            | Group-ClientRequests `
            | c8y userreferences addUserToGroup $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Approve-DeviceRequest {
<#
.SYNOPSIS
Approve device request

.DESCRIPTION
Approve a new device request. Note: a device can only be approved if the platform has received a request for device credentials.

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/deviceregistration_approve

.EXAMPLE
PS> Approve-DeviceRequest -Id $DeviceRequest.id

Approve a new device request


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Device identifier (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Status of registration
        [Parameter()]
        [ValidateSet('ACCEPTED')]
        [string]
        $Status
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Update", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "deviceregistration approve"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.newDeviceRequest+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y deviceregistration approve $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y deviceregistration approve $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Copy-Application {
<#
.SYNOPSIS
Copy application

.DESCRIPTION
A POST request to the 'clone' resource creates a new application based on an already existing one.

The properties are copied to the newly created application. For name, key and context path a 'clone' prefix is added in order to be unique.

If the target application is hosted and has an active version, the new application will have the active version with the same content.

The response contains a representation of the newly created application.

Required role ROLE_APPLICATION_MANAGEMENT_ADMIN


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_copy

.EXAMPLE
PS> Copy-Application -Id $App.id

Copy an existing application


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications copy"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.application+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y applications copy $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y applications copy $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Disable-Application {
<#
.SYNOPSIS
Unsubscribe application

.DESCRIPTION
Disable/unsubscribe an application from a tenant

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/tenants_disableApplication

.EXAMPLE
PS> Disable-Application -Tenant t12345 -Application myMicroservice

Disable an application of a tenant


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Application,

        # Tenant id. Defaults to current tenant (based on credentials)
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Delete"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "tenants disableApplication"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = ""
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Application `
            | Group-ClientRequests `
            | c8y tenants disableApplication $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Application `
            | Group-ClientRequests `
            | c8y tenants disableApplication $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Disable-Microservice {
<#
.SYNOPSIS
unsubscribe microservice

.DESCRIPTION
Disable (unsubscribe) a microservice from the current tenant


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/microservices_disable

.EXAMPLE
PS> Disable-Microservice -Id $App.id

Disable (unsubscribe) to a microservice


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Microservice id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Tenant id
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Delete"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "microservices disable"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = ""
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y microservices disable $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y microservices disable $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Enable-Application {
<#
.SYNOPSIS
Subscribe application

.DESCRIPTION
Enable/subscribe an application to a tenant

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/tenants_enableApplication

.EXAMPLE
PS> Enable-Application -Tenant t12345 -Application myMicroservice

Enable an application of a tenant


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Application,

        # Tenant id. Defaults to current tenant (based on credentials)
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "tenants enableApplication"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Application `
            | Group-ClientRequests `
            | c8y tenants enableApplication $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Application `
            | Group-ClientRequests `
            | c8y tenants enableApplication $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Enable-Microservice {
<#
.SYNOPSIS
subscribe to microservice

.DESCRIPTION
Enabling (subscribing) a microservice will activate the application in the tenant


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/microservices_enable

.EXAMPLE
PS> Enable-Microservice -Id $App.id

Enable (subscribe) to a microservice


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Microservice id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Tenant id
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "microservices enable"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y microservices enable $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y microservices enable $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Find-ByTextManagedObjectCollection {
<#
.SYNOPSIS
Find managed object by text collection

.DESCRIPTION
Find a collection of managedObjects which match a given text value

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/inventory_findByText

.EXAMPLE
PS> Find-ByTextManagedObjectCollection -Text $Device1.name

Find a list of managed objects by text

.EXAMPLE
PS> Find-ByTextManagedObjectCollection -Text $Device1.name

Find managed objects which contain the text 'myText' (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # managed objects containing a text value starting with the given text (placeholder {text}). Text value is any alphanumeric string starting with a latin letter (A-Z or a-z). (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Text,

        # ManagedObject type.
        [Parameter()]
        [string]
        $Type,

        # ManagedObject fragment type.
        [Parameter()]
        [string]
        $FragmentType,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "inventory findByText"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Text `
            | Group-ClientRequests `
            | c8y inventory findByText $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Text `
            | Group-ClientRequests `
            | c8y inventory findByText $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Find-DeviceServiceCollection {
<#
.SYNOPSIS
Find services

.DESCRIPTION
Find services of any device

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_services_find

.EXAMPLE
PS> Find-DeviceServiceCollection

Find all services (from any device)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Additional query filter
        [Parameter()]
        [string]
        $Query,

        # Filter by service type e.g. systemd
        [Parameter()]
        [string]
        $ServiceType,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by service status (custom values allowed)
        [Parameter()]
        [ValidateSet('up','down','unknown')]
        [string]
        $Status,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices services find"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReferenceCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y devices services find $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y devices services find $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Find-ManagedObjectCollection {
<#
.SYNOPSIS
Find managed object collection

.DESCRIPTION
Get a collection of managedObjects based on the Cumulocity query language

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/inventory_find

.EXAMPLE
PS> Find-ManagedObjectCollection -Query "name eq 'roomUpperFloor_*'"

Find all managed objects with their names starting with 'roomUpperFloor_'


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # ManagedObject query
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by type
        [Parameter()]
        [string]
        $Type,

        # Only include agents
        [Parameter()]
        [switch]
        $Agents,

        # Filter by fragment type
        [Parameter()]
        [string]
        $FragmentType,

        # Filter by owner
        [Parameter()]
        [string]
        $Owner,

        # Filter by c8y_Availability.status
        [Parameter()]
        [ValidateSet('AVAILABLE','UNAVAILABLE','MAINTENANCE')]
        [string]
        $Availability,

        # Filter c8y_Availability.lastMessage to a specific date
        [Parameter()]
        [string]
        $LastMessageDateTo,

        # Filter c8y_Availability.lastMessage from a specific date
        [Parameter()]
        [string]
        $LastMessageDateFrom,

        # Filter creationTime.date to a specific date
        [Parameter()]
        [string]
        $CreationTimeDateTo,

        # Filter creationTime.date from a specific date
        [Parameter()]
        [string]
        $CreationTimeDateFrom,

        # Filter by group inclusion
        [Parameter()]
        [object[]]
        $Group,

        # Only include devices (deprecated)
        [Parameter()]
        [switch]
        $OnlyDevices,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "inventory find"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Query `
            | Group-ClientRequests `
            | c8y inventory find $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Query `
            | Group-ClientRequests `
            | c8y inventory find $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Agent {
<#
.SYNOPSIS
Get agent

.DESCRIPTION
Get an agent's managed object representation

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/agents_get

.EXAMPLE
PS> Get-Agent -Id $agent.id

Get agent by id

.EXAMPLE
PS> Get-Agent -Id $agent.name

Get agent by name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Agent ID (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "agents get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.customAgent+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y agents get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y agents get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AgentCollection {
<#
.SYNOPSIS
Get agent collection

.DESCRIPTION
Get a collection of agents based on filter parameters

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/agents_list

.EXAMPLE
PS> Get-AgentCollection -Name "sensor*" -Type myType

Get a collection of agents with type "myType", and their names start with "sensor"


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Additional query filter
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by type
        [Parameter()]
        [string]
        $Type,

        # Filter by fragment type
        [Parameter()]
        [string]
        $FragmentType,

        # Filter by owner
        [Parameter()]
        [string]
        $Owner,

        # Filter by c8y_Availability.status
        [Parameter()]
        [ValidateSet('AVAILABLE','UNAVAILABLE','MAINTENANCE')]
        [string]
        $Availability,

        # Filter c8y_Availability.lastMessage to a specific date
        [Parameter()]
        [string]
        $LastMessageDateTo,

        # Filter c8y_Availability.lastMessage from a specific date
        [Parameter()]
        [string]
        $LastMessageDateFrom,

        # Filter creationTime.date to a specific date
        [Parameter()]
        [string]
        $CreationTimeDateTo,

        # Filter creationTime.date from a specific date
        [Parameter()]
        [string]
        $CreationTimeDateFrom,

        # Filter by group inclusion
        [Parameter()]
        [object[]]
        $Group,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "agents list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedobjectcollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.customAgent+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Query `
            | Group-ClientRequests `
            | c8y agents list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Query `
            | Group-ClientRequests `
            | c8y agents list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Alarm {
<#
.SYNOPSIS
Get alarm

.DESCRIPTION
Get an alarm by its id

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/alarms_get

.EXAMPLE
PS> Get-Alarm -Id {{ NewAlarm }}

Get alarm


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Alarm id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "alarms get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.alarm+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y alarms get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y alarms get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AlarmCollection {
<#
.SYNOPSIS
Get alarm collection

.DESCRIPTION
Get a collection of alarms based on filter parameters

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/alarms_list

.EXAMPLE
PS> Get-AlarmCollection -Severity MAJOR -PageSize 100

Get alarms with the severity set to MAJOR

.EXAMPLE
PS> Get-AlarmCollection -DateFrom "-10m" -Status ACTIVE

Get active alarms which occurred in the last 10 minutes

.EXAMPLE
PS> Get-DeviceCollection -Name $Device.name | Get-AlarmCollection -Status ACTIVE

Get active alarms from a device (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Source device id.
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Device,

        # Start date or date and time of alarm occurrence.
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of alarm occurrence.
        [Parameter()]
        [string]
        $DateTo,

        # Alarm type.
        [Parameter()]
        [string]
        $Type,

        # Comma separated alarm statuses, for example ACTIVE,CLEARED.
        [Parameter()]
        [ValidateSet('ACTIVE','ACKNOWLEDGED','CLEARED')]
        [string[]]
        $Status,

        # Alarm severity, for example CRITICAL, MAJOR, MINOR or WARNING.
        [Parameter()]
        [ValidateSet('CRITICAL','MAJOR','MINOR','WARNING')]
        [string]
        $Severity,

        # When set to true only resolved alarms will be removed (the one with status CLEARED), false means alarms with status ACTIVE or ACKNOWLEDGED.
        [Parameter()]
        [switch]
        $Resolved,

        # When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
        [Parameter()]
        [switch]
        $WithSourceAssets,

        # When set to true also alarms for related source devices will be removed. When this parameter is provided also source must be defined.
        [Parameter()]
        [switch]
        $WithSourceDevices,

        # Start date or date and time of the alarm creation. Version >= 10.11
        [Parameter()]
        [string]
        $CreatedFrom,

        # End date or date and time of the alarm creation. Version >= 10.11
        [Parameter()]
        [string]
        $CreatedTo,

        # Start date or date and time of the last update made. Version >= 10.11
        [Parameter()]
        [string]
        $LastUpdatedFrom,

        # End date or date and time of the last update made. Version >= 10.11
        [Parameter()]
        [string]
        $LastUpdatedTo
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "alarms list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.alarmCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.alarm+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Device `
            | Group-ClientRequests `
            | c8y alarms list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Device `
            | Group-ClientRequests `
            | c8y alarms list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AlarmCount {
<#
.SYNOPSIS
Retrieve the total number of alarms

.DESCRIPTION
Count the total number of active alarms on your tenant

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/alarms_count

.EXAMPLE
PS> Get-AlarmCount -Severity MAJOR

Get number of active alarms with the severity set to MAJOR

.EXAMPLE
PS> Get-AlarmCount -DateFrom "-10m" -Status ACTIVE

Get number of active alarms which occurred in the last 10 minutes

.EXAMPLE
PS> Get-AlarmCount -DateFrom "-10m" -Status ACTIVE -Device $Device.name

Get number of active alarms which occurred in the last 10 minutes on a device

.EXAMPLE
PS> Get-Device -Id $Device.id | Get-AlarmCount -DateFrom "-10m"

Get number of alarms from a list of devices using pipeline


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Source device id.
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Device,

        # Start date or date and time of alarm occurrence.
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of alarm occurrence.
        [Parameter()]
        [string]
        $DateTo,

        # Alarm type.
        [Parameter()]
        [string]
        $Type,

        # Comma separated alarm statuses, for example ACTIVE,CLEARED.
        [Parameter()]
        [ValidateSet('ACTIVE','ACKNOWLEDGED','CLEARED')]
        [string[]]
        $Status,

        # Alarm severity, for example CRITICAL, MAJOR, MINOR or WARNING.
        [Parameter()]
        [ValidateSet('CRITICAL','MAJOR','MINOR','WARNING')]
        [string]
        $Severity,

        # When set to true only resolved alarms will be removed (the one with status CLEARED), false means alarms with status ACTIVE or ACKNOWLEDGED.
        [Parameter()]
        [switch]
        $Resolved,

        # When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
        [Parameter()]
        [switch]
        $WithSourceAssets,

        # When set to true also alarms for related source devices will be removed. When this parameter is provided also source must be defined.
        [Parameter()]
        [switch]
        $WithSourceDevices
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "alarms count"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "text/plain"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Device `
            | Group-ClientRequests `
            | c8y alarms count $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Device `
            | Group-ClientRequests `
            | c8y alarms count $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AllTenantUsageSummaryStatistics {
<#
.SYNOPSIS
Get all tenant usage summary statistics

.DESCRIPTION
Get collection of tenant usage statistics summary

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/tenantstatistics_listSummaryAllTenants

.EXAMPLE
PS> Get-AllTenantUsageSummaryStatistics

Get tenant summary statistics for all tenants

.EXAMPLE
PS> Get-AllTenantUsageSummaryStatistics -DateFrom "-30d"

Get tenant summary statistics collection for the last 30 days

.EXAMPLE
PS> Get-AllTenantUsageSummaryStatistics -DateFrom "-10d" -DateTo "-9d"

Get tenant summary statistics collection for the last 10 days, only return until the last 9 days


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Start date or date and time of the statistics.
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of the statistics.
        [Parameter()]
        [string]
        $DateTo
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "tenantstatistics listSummaryAllTenants"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y tenantstatistics listSummaryAllTenants $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y tenantstatistics listSummaryAllTenants $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Application {
<#
.SYNOPSIS
Get application

.DESCRIPTION
Get an existing application

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_get

.EXAMPLE
PS> Get-Application -Id $App.id

Get an application by id

.EXAMPLE
PS> Get-Application -Id $App.name

Get an application by name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.application+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y applications get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y applications get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ApplicationBinaryCollection {
<#
.SYNOPSIS
Get application binaries

.DESCRIPTION
A list of all binaries related to the given application will be returned


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_listApplicationBinaries

.EXAMPLE
PS> Get-ApplicationBinaryCollection -Id $App.id

List all of the binaries related to a Hosted (web) application

.EXAMPLE
PS> Get-Application $App.id | Get-ApplicationBinaryCollection

List all of the binaries related to a Hosted (web) application (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications listApplicationBinaries"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.customAttachmentCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.customBinaryAttachment+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y applications listApplicationBinaries $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y applications listApplicationBinaries $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ApplicationCollection {
<#
.SYNOPSIS
Get application collection

.DESCRIPTION
Get a collection of applications by a given filter

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_list

.EXAMPLE
PS> Get-ApplicationCollection -PageSize 100

Get applications


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application type
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [ValidateSet('APAMA_CEP_RULE','EXTERNAL','HOSTED','MICROSERVICE')]
        [object[]]
        $Type,

        # The name of the application.
        [Parameter()]
        [string]
        $Name,

        # The ID of the tenant that owns the applications.
        [Parameter()]
        [string]
        $Owner,

        # The ID of a tenant that is subscribed to the applications but doesn't own them.
        [Parameter()]
        [string]
        $ProvidedFor,

        # The ID of a tenant that is subscribed to the applications.
        [Parameter()]
        [string]
        $Subscriber,

        # The ID of a user that has access to the applications.
        [Parameter()]
        [object[]]
        $User,

        # The ID of a tenant that either owns the application or is subscribed to the applications.
        [Parameter()]
        [string]
        $Tenant,

        # When set to true, the returned result contains applications with an applicationVersions field that is not empty. When set to false, the result will contain applications with an empty applicationVersions field.
        [Parameter()]
        [switch]
        $HasVersions,

        # Application access level for other tenants.
        [Parameter()]
        [ValidateSet('SHARED','PRIVATE','MARKET')]
        [string]
        $Availability
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.application+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Type `
            | Group-ClientRequests `
            | c8y applications list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Type `
            | Group-ClientRequests `
            | c8y applications list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ApplicationReferenceCollection {
<#
.SYNOPSIS
Get application reference collection

.DESCRIPTION
Get a collection of application references on a tenant

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/tenants_listReferences

.EXAMPLE
PS> Get-ApplicationReferenceCollection -Tenant mycompany

Get a list of referenced applications on a given tenant (from management tenant)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Tenant id
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "tenants listReferences"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationReferenceCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.applicationReference+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Tenant `
            | Group-ClientRequests `
            | c8y tenants listReferences $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Tenant `
            | Group-ClientRequests `
            | c8y tenants listReferences $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ApplicationVersion {
<#
.SYNOPSIS
Get a specific version of an application

.DESCRIPTION
Retrieve the selected version of an application in your tenant. To select the version, use only the version or only the tag query parameter

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_versions_get

.EXAMPLE
PS> Get-ApplicationVersion -Application 1234 -Tag tag1

Get application version by tag

.EXAMPLE
PS> Get-ApplicationVersion -Application 1234 -Version 1.0

Get application version by version name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Application,

        # The version field of the application version
        [Parameter()]
        [string]
        $Version,

        # The tag of the application version
        [Parameter()]
        [string]
        $Tag
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications versions get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationVersion+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Application `
            | Group-ClientRequests `
            | c8y applications versions get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Application `
            | Group-ClientRequests `
            | c8y applications versions get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ApplicationVersionCollection {
<#
.SYNOPSIS
Get application version collection

.DESCRIPTION
Get a collection of application versions by a given filter

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/applications_versions_list

.EXAMPLE
PS> Get-ApplicationVersionCollection -Application 1234

Get application versions


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Application
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Application
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "applications versions list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationVersionCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.applicationVersion+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Application `
            | Group-ClientRequests `
            | c8y applications versions list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Application `
            | Group-ClientRequests `
            | c8y applications versions list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AuditRecord {
<#
.SYNOPSIS
Get audit record

.DESCRIPTION
Get an audit record

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/auditrecords_get

.EXAMPLE
PS> Get-AuditRecord -Id $Record.id

Get an audit record by id


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Audit id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "auditrecords get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.auditRecord+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y auditrecords get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y auditrecords get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-AuditRecordCollection {
<#
.SYNOPSIS
Get audit record collection

.DESCRIPTION
Audit records contain information about modifications to other Cumulocity entities.

For example the audit records contain each operation state transition, so they can be used to check when an operation transitioned from PENDING -> EXECUTING -> SUCCESSFUL.


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/auditrecords_list

.EXAMPLE
PS> Get-AuditRecordCollection -PageSize 100

Get a list of audit records

.EXAMPLE
PS> Get-AuditRecordCollection -Source $Device2.id

Get a list of audit records related to a managed object

.EXAMPLE
PS> Get-Operation -Id $Operation.id | Get-AuditRecordCollection

Get a list of audit records related to an operation


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Source Id or object containing an .id property of the element that should be detected. i.e. AlarmID, or Operation ID. Note: Only one source can be provided
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object]
        $Source,

        # Type
        [Parameter()]
        [string]
        $Type,

        # Username
        [Parameter()]
        [string]
        $User,

        # Application
        [Parameter()]
        [string]
        $Application,

        # Start date or date and time of audit record occurrence.
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of audit record occurrence.
        [Parameter()]
        [string]
        $DateTo,

        # Return the newest instead of the oldest audit records. Must be used with dateFrom and dateTo parameters
        [Parameter()]
        [switch]
        $Revert
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "auditrecords list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.auditRecordCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.auditRecord+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Source `
            | Group-ClientRequests `
            | c8y auditrecords list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Source `
            | Group-ClientRequests `
            | c8y auditrecords list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Binary {
<#
.SYNOPSIS
Download binary

.DESCRIPTION
Download a binary stored in Cumulocity and display it on the console.

For non text based binaries or if the output should be saved to file, the output parameter should be used to write the file directly to a local file.


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/binaries_get

.EXAMPLE
PS> Get-Binary -Id $Binary.id

Get a binary and display the contents on the console

.EXAMPLE
PS> Get-Binary -Id $Binary.id -OutputFileRaw ./download-binary1.txt

Get a binary and save it to a file


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Inventory binary id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "binaries get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "*/*"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y binaries get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y binaries get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-BinaryCollection {
<#
.SYNOPSIS
Get binary collection

.DESCRIPTION
Get a collection of inventory binaries. The results include the meta information about binary and not the binary itself.


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/binaries_list

.EXAMPLE
PS> Get-BinaryCollection -PageSize 100

Get a list of binaries


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # The managed object IDs to search for.
        [Parameter()]
        [string[]]
        $Ids,

        # The type of managed object to search for.
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Type,

        # Username of the owner of the managed objects.
        [Parameter()]
        [string]
        $Owner,

        # Search for managed objects where any property value is equal to the given one. Only string values are supported.
        [Parameter()]
        [string]
        $Text,

        # Search for a specific child addition and list all the groups to which it belongs.
        [Parameter()]
        [string]
        $ChildAdditionId,

        # Search for a specific child asset and list all the groups to which it belongs.
        [Parameter()]
        [string]
        $ChildAssetId,

        # Search for a specific child device and list all the groups to which it belongs.
        [Parameter()]
        [object[]]
        $ChildDeviceId
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "binaries list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Type `
            | Group-ClientRequests `
            | c8y binaries list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Type `
            | Group-ClientRequests `
            | c8y binaries list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-BulkOperation {
<#
.SYNOPSIS
Get bulk operation

.DESCRIPTION
Get an existing bulk operation

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/bulkoperations_get

.EXAMPLE
PS> Get-BulkOperation -Id $BulkOp.id

Get bulk operation by id


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Bulk Operation id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "bulkoperations get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.bulkoperation+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y bulkoperations get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y bulkoperations get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-BulkOperationCollection {
<#
.SYNOPSIS
Get bulk operation collection

.DESCRIPTION
Get a collection of bulk operations

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/bulkoperations_list

.EXAMPLE
PS> Get-BulkOperationCollection

Get a list of bulk operations

.EXAMPLE
PS> Get-BulkOperationCollection -DateFrom -1d

Get a list of bulk operations created in the last 1 day

.EXAMPLE
PS> Get-BulkOperationCollection -Status SCHEDULED, EXECUTING

Get a list of bulk operations in the general status SCHEDULED or EXECUTING


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Include CANCELLED bulk operations
        [Parameter()]
        [switch]
        $WithDeleted,

        # Start date or date and time of the bulk operation
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of the bulk operation
        [Parameter()]
        [string]
        $DateTo,

        # Operation status, can be one of SUCCESSFUL, FAILED, EXECUTING or PENDING.
        [Parameter()]
        [ValidateSet('CANCELED','SCHEDULED','EXECUTING','EXECUTING_WITH_ERROR','FAILED')]
        [string[]]
        $Status
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "bulkoperations list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.bulkOperationCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.bulkoperation+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y bulkoperations list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y bulkoperations list $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-BulkOperationOperationCollection {
<#
.SYNOPSIS
Get operations collection

.DESCRIPTION
Get a collection of operations related to a bulk operation

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/bulkoperations_listOperations

.EXAMPLE
PS> Get-BulkOperationOperationCollection -Id 10 -Status PENDING

Get a list of pending operations from bulk operation with id 10

.EXAMPLE
PS> Get-BulkOperationCollection | Where-Object { $_.status -eq "IN_PROGRESS" } | Get-BulkOperationOperationCollection -Status PENDING

Get all pending operations from all bulk operations which are still in progress (using pipeline)

.EXAMPLE
PS> Get-BulkOperationCollection | Get-BulkOperationOperationCollection -status EXECUTING --dateTo "-10d" | Update-Operation -Status FAILED -FailureReason "Manually cancelled stale operation"

Check all bulk operations if they have any related operations still in executing state and were created more than 10 days ago, then cancel it with a custom message


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Bulk operation id. (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Start date or date and time of operation.
        [Parameter()]
        [string]
        $DateFrom,

        # End date or date and time of operation.
        [Parameter()]
        [string]
        $DateTo,

        # Operation status, can be one of SUCCESSFUL, FAILED, EXECUTING or PENDING.
        [Parameter()]
        [ValidateSet('PENDING','EXECUTING','SUCCESSFUL','FAILED')]
        [string]
        $Status,

        # Sort operations newest to oldest. Must be used with dateFrom and/or dateTo parameters
        [Parameter()]
        [switch]
        $Revert
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "bulkoperations listOperations"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.operationCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.operation+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y bulkoperations listOperations $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y bulkoperations listOperations $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Configuration {
<#
.SYNOPSIS
Get configuration

.DESCRIPTION
Get an existing configuration package (managedObject)

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/configuration_get

.EXAMPLE
PS> Get-Configuration -Id $mo.id

Get a configuration package

.EXAMPLE
PS> Get-ManagedObject -Id $mo.id | Get-Configuration

Get a configuration package (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Configuration package (managedObject) id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "configuration get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.inventory+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y configuration get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y configuration get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-ConfigurationCollection {
<#
.SYNOPSIS
Get configuration collection

.DESCRIPTION
Get a collection of configuration (managedObjects) based on filter parameters

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/configuration_list

.EXAMPLE
PS> Get-ConfigurationCollection

Get a list of configuration files


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Additional query filter
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Filter by configurationType
        [Parameter()]
        [string]
        $ConfigurationType,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by deviceType
        [Parameter()]
        [string]
        $DeviceType,

        # Filter by description
        [Parameter()]
        [string]
        $Description,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "configuration list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Query `
            | Group-ClientRequests `
            | c8y configuration list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Query `
            | Group-ClientRequests `
            | c8y configuration list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-CurrentApplication {
<#
.SYNOPSIS
Get current application

.DESCRIPTION
Getting the current application only works when using bootstrap credentials from an application (not user credentials)


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/currentapplication_get

.EXAMPLE
PS> Get-CurrentApplication

Get the current application (requires using application credentials)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "currentapplication get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.application+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y currentapplication get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y currentapplication get $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-CurrentApplicationSubscription {
<#
.SYNOPSIS
Get current application subscriptions

.DESCRIPTION
Requires authentication with the application bootstrap user

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/currentapplication_listSubscriptions

.EXAMPLE
PS> Get-CurrentApplicationSubscription

List the current application users/subscriptions


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "currentapplication listSubscriptions"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.applicationUserCollection+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y currentapplication listSubscriptions $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y currentapplication listSubscriptions $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-CurrentTenant {
<#
.SYNOPSIS
Get current tenant

.DESCRIPTION
Get the current tenant associated with the current session

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/currenttenant_get

.EXAMPLE
PS> Get-CurrentTenant

Get the current tenant (based on your current credentials)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "currenttenant get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.currentTenant+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y currenttenant get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y currenttenant get $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-CurrentTenantApplicationCollection {
<#
.SYNOPSIS
List applications in current tenant

.DESCRIPTION
Get the applications of the current tenant

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/currenttenant_listApplications

.EXAMPLE
PS> Get-CurrentTenantApplicationCollection

Get a list of applications in the current tenant


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "currenttenant listApplications"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.currentTenant+json"
            ItemType = "application/vnd.com.nsn.cumulocity.application+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y currenttenant listApplications $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y currenttenant listApplications $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-CurrentUser {
<#
.SYNOPSIS
Get current user

.DESCRIPTION
Get the user representation associated with the current credentials used by the request

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/currentuser_get

.EXAMPLE
PS> Get-CurrentUser

Get the current user


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "currentuser get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.currentUser+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y currentuser get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y currentuser get $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DataBrokerConnector {
<#
.SYNOPSIS
Get data broker

.DESCRIPTION
Get an existing data broker connector

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/databroker_get

.EXAMPLE
PS> Get-DataBrokerConnector -Id $DataBroker.id

Get a data broker connector


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Data broker connector id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "databroker get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.databrokerConnector+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y databroker get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y databroker get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DataBrokerConnectorCollection {
<#
.SYNOPSIS
Get data broker collection

.DESCRIPTION
Get a collection of existing data broker connectors

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/databroker_list

.EXAMPLE
PS> Get-DataBrokerConnectorCollection

Get a list of data broker connectors


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(

    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "databroker list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.databrokerConnectorCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.databrokerConnector+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y databroker list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y databroker list $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DataHubJob {
<#
.SYNOPSIS
Retrieve the status of a query job

.DESCRIPTION
Retrieve the status of a query given the ID of the Dremio job executing the query

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/datahub_jobs_get

.EXAMPLE
PS> Get-DataHubJob -Id "22feee74-875a-561c-5508-04114bdda000"

Retrieve a datahub job


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # The unique identifier of a Dremio job (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "datahub jobs get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y datahub jobs get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y datahub jobs get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DataHubJobResult {
<#
.SYNOPSIS
Retrieve the query results given the ID of the Dremio job that has executed the query

.DESCRIPTION
Retrieve the query results given the ID of the Dremio job that has executed the query

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/datahub_jobs_listResults

.EXAMPLE
PS> Get-DataHubJobResult -Id "22feee74-875a-561c-5508-04114bdda000"

Retrieve a datahub job


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # The unique identifier of a Dremio job (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # The offset of the paginated results
        [Parameter()]
        [long]
        $Offset
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "datahub jobs listResults"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y datahub jobs listResults $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y datahub jobs listResults $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DataHubQueryResult {
<#
.SYNOPSIS
Execute a SQL query and retrieve the results

.DESCRIPTION
Execute a SQL query and retrieve the results

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/datahub_query

.EXAMPLE
PS> Get-DataHubQueryResult -Sql "SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms"

Get a list of alarms from datahub


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # The version of the high-performance API
        [Parameter()]
        [string]
        $Version,

        # The SQL query to execute
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Sql,

        # The maximum number of query results
        [Parameter()]
        [long]
        $Limit,

        # The response format, which is either DREMIO or PANDAS. The DREMIO format is the same response format as provided by the sql endpoint of the Standard API. The PANDAS format fits to the data format the Pandas library for Python expects.
        [Parameter()]
        [ValidateSet('DREMIO','PANDAS')]
        [string]
        $Format
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Create", "Template"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "datahub query"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Sql `
            | Group-ClientRequests `
            | c8y datahub query $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Sql `
            | Group-ClientRequests `
            | c8y datahub query $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-Device {
<#
.SYNOPSIS
Get device

.DESCRIPTION
Get an existing device

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_get

.EXAMPLE
PS> Get-Device -Id $device.id

Get device by id

.EXAMPLE
PS> Get-Device -Id $device.name

Get device by name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Device ID (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.customDevice+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devices get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devices get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceAvailability {
<#
.SYNOPSIS
Get device availability

.DESCRIPTION
Retrieve the date when a specific managed object (by a given ID) sent the last message to Cumulocity IoT.

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_availability_get

.EXAMPLE
PS> Get-DeviceAvailability -Id $Device.id

Get a device's availability by id

.EXAMPLE
PS> Get-DeviceAvailability -Id $Device.name

Get a device's availability by name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Device. (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices availability get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = ""
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devices availability get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devices availability get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceCertificate {
<#
.SYNOPSIS
Get trusted device certificate

.DESCRIPTION
Get a trusted device certificate

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicemanagement_certificates_get

.EXAMPLE
PS> Get-DeviceCertificate -Id abcedef0123456789abcedef0123456789

Get trusted device certificate by id/fingerprint


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Certificate fingerprint or name
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Tenant id
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicemanagement certificates get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devicemanagement certificates get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devicemanagement certificates get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceCertificateCollection {
<#
.SYNOPSIS
List device certificates

.DESCRIPTION
List the trusted device certificates


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicemanagement_certificates_list

.EXAMPLE
PS> Get-DeviceCertificateCollection

Get list of trusted device certificates


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Tenant id
        [Parameter()]
        [object]
        $Tenant
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicemanagement certificates list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.customTrustedCertificateCollection+json"
            ItemType = "application/json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            c8y devicemanagement certificates list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            c8y devicemanagement certificates list $c8yargs
        }
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceChild {
<#
.SYNOPSIS
Get child

.DESCRIPTION
Get a child of a device

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_children_get

.EXAMPLE
PS> Get-DeviceChild -Id $Agent.id -Child $Ref.id -ChildType addition

Get an existing child managed object


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType,

        # Child managed object id (required)
        [Parameter(Mandatory = $true)]
        [object[]]
        $Child
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices children get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devices children get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devices children get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceChildCollection {
<#
.SYNOPSIS
Get child collection

.DESCRIPTION
Get a collection of child managedObjects

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_children_list

.EXAMPLE
PS> Get-DeviceChildCollection -Id 12345 -ChildType addition

Get a list of the child additions of an existing managed object

.EXAMPLE
PS> Get-ManagedObject -Id 12345 | Get-DeviceChildCollection -ChildType addition

Get a list of the child additions of an existing managed object (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id. (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType,

        # Additional query filter
        [Parameter()]
        [string]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices children list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReferenceCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devices children list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devices children list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceCollection {
<#
.SYNOPSIS
Get device collection

.DESCRIPTION
Get a collection of devices based on filter parameters

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devices_list

.EXAMPLE
PS> Get-DeviceCollection -Name "sensor*" -Type myType

c8y devices list --name "sensor*" --type myType


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Additional query filter
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by type
        [Parameter()]
        [string]
        $Type,

        # Only include agents
        [Parameter()]
        [switch]
        $Agents,

        # Filter by fragment type
        [Parameter()]
        [string]
        $FragmentType,

        # Filter by owner
        [Parameter()]
        [string]
        $Owner,

        # Filter by c8y_Availability.status
        [Parameter()]
        [ValidateSet('AVAILABLE','UNAVAILABLE','MAINTENANCE')]
        [string]
        $Availability,

        # Filter c8y_Availability.lastMessage to a specific date
        [Parameter()]
        [string]
        $LastMessageDateTo,

        # Filter c8y_Availability.lastMessage from a specific date
        [Parameter()]
        [string]
        $LastMessageDateFrom,

        # Filter creationTime.date to a specific date
        [Parameter()]
        [string]
        $CreationTimeDateTo,

        # Filter creationTime.date from a specific date
        [Parameter()]
        [string]
        $CreationTimeDateFrom,

        # Filter by group inclusion
        [Parameter()]
        [object[]]
        $Group,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devices list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedobjectcollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.customDevice+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Query `
            | Group-ClientRequests `
            | c8y devices list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Query `
            | Group-ClientRequests `
            | c8y devices list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceGroup {
<#
.SYNOPSIS
Get device group

.DESCRIPTION
Get a device group


.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicegroups_get

.EXAMPLE
PS> Get-DeviceGroup -Id $group.id

Get device group by id

.EXAMPLE
PS> Get-DeviceGroup -Id $group.name

Get device group by name


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Device group ID (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount,

        # When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
        [Parameter()]
        [switch]
        $WithGroups,

        # Include a flat list of all parents and grandparents of the given object
        [Parameter()]
        [switch]
        $WithParents
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicegroups get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.customDeviceGroup+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceGroupChild {
<#
.SYNOPSIS
Get child

.DESCRIPTION
Get managed object child

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicegroups_children_get

.EXAMPLE
PS> Get-DeviceGroupChild -Id $Agent.id -Child $Ref.id -ChildType addition

Get an existing child managed object


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType,

        # Child managed object id (required)
        [Parameter(Mandatory = $true)]
        [object[]]
        $Child
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicegroups children get"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReference+json"
            ItemType = ""
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups children get $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups children get $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceGroupChildCollection {
<#
.SYNOPSIS
Get child collection

.DESCRIPTION
Get a collection of child managedObjects

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicegroups_children_list

.EXAMPLE
PS> Get-DeviceGroupChildCollection -Id 12345 -ChildType addition

Get a list of the child additions of an existing managed object

.EXAMPLE
PS> Get-ManagedObject -Id 12345 | Get-DeviceGroupChildCollection -ChildType addition

Get a list of the child additions of an existing managed object (using pipeline)


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # Managed object id. (required)
        [Parameter(Mandatory = $true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Id,

        # Child relationship type (required)
        [Parameter(Mandatory = $true)]
        [ValidateSet('addition','asset','device')]
        [string]
        $ChildType,

        # Additional query filter
        [Parameter()]
        [string]
        $Query,

        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
        [Parameter()]
        [switch]
        $WithChildren,

        # When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices)
        [Parameter()]
        [switch]
        $WithChildrenCount
    )
    DynamicParam {
        Get-ClientCommonParameters -Type "Get", "Collection"
    }

    Begin {

        if ($env:C8Y_DISABLE_INHERITANCE -ne $true) {
            # Inherit preference variables
            Use-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState
        }

        $c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "devicegroups children list"
        $ClientOptions = Get-ClientOutputOption $PSBoundParameters
        $TypeOptions = @{
            Type = "application/vnd.com.nsn.cumulocity.managedObjectReferenceCollection+json"
            ItemType = "application/vnd.com.nsn.cumulocity.managedObject+json"
            BoundParameters = $PSBoundParameters
        }
    }

    Process {

        if ($ClientOptions.ConvertToPS) {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups children list $c8yargs `
            | ConvertFrom-ClientOutput @TypeOptions
        }
        else {
            $Id `
            | Group-ClientRequests `
            | c8y devicegroups children list $c8yargs
        }
        
    }

    End {}
}

# Code generated from specification version 1.0.0: DO NOT EDIT
Function Get-DeviceGroupCollection {
<#
.SYNOPSIS
Get device group collection

.DESCRIPTION
Get a collection of device groups based on filter parameters

.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/devicegroups_list

.EXAMPLE
PS> Get-DeviceGroupCollection -Name "parent*"

Get a collection of device groups with names that start with 'parent'


#>

    [cmdletbinding(PositionalBinding=$true,
                   HelpUri='')]
    [Alias()]
    [OutputType([object])]
    Param(
        # String template to be used when applying the given query. Use %s to reference the query/pipeline input
        [Parameter()]
        [string]
        $QueryTemplate,

        # Order by. e.g. _id asc or name asc or creationTime.date desc
        [Parameter()]
        [string]
        $OrderBy,

        # Additional query filter
        [Parameter(ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [object[]]
        $Query,

        # Filter by name
        [Parameter()]
        [string]
        $Name,

        # Filter by type
        [Parameter()]
        [string]
        $Type,

        # Filter by fragment type
        [Parameter()]
        [string]
        $FragmentType,

        # Filter by owner
        [Parameter()]
        [string]
        $Owner,

        # Filter by group inclusion
        [Parameter()]
        [switch]
        $ExcludeRootGroup,

        # Filter by group inclusion
        [Parameter()]
        [object[]]
        $Group,

        # Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
        [Parameter()]
        [switch]
        $SkipChildrenNames,

        # Include names of child assets (only use where necessary as it is slow for large groups)
        [Parameter()]