property/Get-Property.ps1
function Get-Property { Param( [Parameter(ParameterSetName="name", Mandatory=$true)] [string] $PropertyName, [Parameter(ParameterSetName="id", Mandatory=$true)] [string] $PropertyId, [Parameter(Mandatory=$false)] [string] $GroupID, [Parameter(Mandatory=$false)] [string] $ContractId, [Parameter(Mandatory=$false)] [string] $EdgeRCFile = '~\.edgerc', [Parameter(Mandatory=$false)] [string] $Section = 'papi', [Parameter(Mandatory=$false)] [string] $AccountSwitchKey ) # Find property if user has specified PropertyName if($PropertyName){ try{ $Property = Find-Property -PropertyName $PropertyName -latest -EdgeRCFile $EdgeRCFile -Section $Section -AccountSwitchKey $AccountSwitchKey $PropertyID = $Property.propertyId if($PropertyID -eq ''){ throw "Property '$PropertyName' not found" } } catch{ throw $_.Exception } } $Path = "/papi/v1/properties/$PropertyId`?contractId=$ContractId&groupId=$GroupID&accountSwitchKey=$AccountSwitchKey" try { $Result = Invoke-AkamaiRestMethod -Method GET -Path $Path -EdgeRCFile $EdgeRCFile -Section $Section return $Result.properties.items } catch { throw $_.Exception } } |