46 lines
1.8 KiB
PowerShell
46 lines
1.8 KiB
PowerShell
|
function ConvertTo-JiraTeamMember {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Convert the provided objects to Jira Team Member representation objects
|
||
|
|
||
|
.OUTPUTS
|
||
|
Returns a [object[]] of TeamMember.
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([string[]])]
|
||
|
param (
|
||
|
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)]
|
||
|
$TeamMember
|
||
|
)
|
||
|
begin {
|
||
|
$logLead = (Get-LogLeadName)
|
||
|
|
||
|
# Define the defaults for the DriveObject response to add some custom display information
|
||
|
$defaultTypeName = 'JiraTeamMember'
|
||
|
$defaultKeys = @('Name')
|
||
|
$defaultDisplaySet = @('Name', 'Role', 'DisplayName', 'Inactive')
|
||
|
$defaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$defaultDisplaySet)
|
||
|
$defaultKeyPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultKeyPropertySet',[string[]]$defaultKeys)
|
||
|
$PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($defaultDisplayPropertySet,$defaultKeyPropertySet)
|
||
|
}
|
||
|
process {
|
||
|
try {
|
||
|
$teamMemberObject = New-Object PSCustomObject -Property @{
|
||
|
Name = $TeamMember.Name
|
||
|
Role = $TeamMember.Role
|
||
|
DisplayName = $TeamMember.DisplayName
|
||
|
Inactive = $TeamMember.Inactive
|
||
|
}
|
||
|
|
||
|
#Give this object a unique typename
|
||
|
$teamMemberObject.PSObject.TypeNames.Insert(0,$defaultTypeName)
|
||
|
$teamMemberObject | Add-Member -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers
|
||
|
|
||
|
return $teamMemberObject
|
||
|
} catch {
|
||
|
Write-Warning "$logLead : Could not convert item to JiraTeam object. Check error below. Returning `$null"
|
||
|
Write-ErrorObject -ErrorItem $PSItem
|
||
|
return $null
|
||
|
}
|
||
|
}
|
||
|
}
|