#################### DevContainer attribute functions - BEGIN #################### #region Function Get-CoreClusterGroups { <# .SYNOPSIS Function for getting a cluster groups from an account in CORE via CTKAPI .DESCRIPTION This function will allow you to retrieve all the cluster groups under an account DevContainer.DeviceContainer is basically cluster groups in CORE Make sure you check the CustomAttribute help as well, as this may be useful for limiting your querys .PARAMETER Account Mandatory Integer Account number that you want to retrieve cluster groups for Single account only! Validated against regex Example: 1103359 Example: 965448 .PARAMETER FullObject Optional Switch Retuns the full object from core (.result) plus the time taken by the query,load args,limit,offset,count of objects retruned,etc If switch is not specified the .result content are only returned i.e. the data from core which is the default. .EXAMPLE Get all cluster groups from account 1103359 $ClusterGroups = Get-CoreClusterGroups -Account 1103359 .OUTPUTS The result object from Core .NOTES Written by Martin Howlett / Mark Wichall #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [ValidatePattern("^\d{4,12}$")] [ValidateCount(1,249)] [Alias('Accounts')] [string]$Account, [ValidateNotNullOrEmpty()] [Switch]$FullObject ) Begin { Write-Verbose "Start of $($MyInvocation.MyCommand)" } Process { #Get the account ID from the account number #Build our variables for the Core where statement handler [Hashtable]$WrapperParams = @{ LoadArgument = "$Account" attributes = @{ "AccountId" = "id" } Class = "Account" } $AccountResult = Invoke-CoreAttributeWrapper @WrapperParams #Query our DevContainer class to get the cluster groups [Hashtable]$WrapperParams = @{ Class = "DevContainer" Subclass = "DeviceContainer" Attributes = @{ "id" = "id" "name" = "name" "type" = "container_type" "virtual" = "member_servers.number" "nodes" = "connected_servers.number" } LoadMethod = "loadList" LoadArgument = @{"account"=$($AccountResult.result.AccountID)} } $result = Invoke-CoreAttributeWrapper @WrapperParams #returns the .result value as default, full object returned if $FullObject switch used. If (-not $FullObject) { $result = $result.result } return $result } End { #Log to appstats Set-LogtoAppstats -FunctionID "Find-CoreTicket" -AppID "PoshCore" Write-Verbose "End of $($MyInvocation.MyCommand)" } } #endregion #################### DevContainer attribute functions - END #####################