338 lines
14 KiB
PowerShell
338 lines
14 KiB
PowerShell
|
function New-JiraDevTicket {
|
||
|
param (
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
[string]$Summary,
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
[string]$Body,
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
[ValidateSet('Account Intelligence','Account Services','Analytics Visualization','API','Business Payments','Business Services','Carbon','Card Experience','Core Custom','Core Standard','Data Engine','Ignite','MMA','MMC','Mobile Platform','Native Mobile Android','Native Mobile iOS','PlatformB','SDK','Sidekick','Steam','Sustained Development','Vanguard','WidgetsD','AI','AS','AV','BIZPAY','BIZSVC','CE','CORECUSTOM','CORE','DE','Mobile','Android','iOS','PLAT','COM','ARCH','BIZDATABILLING','WIDD','TI','CS','FS')]
|
||
|
[string]$Team,
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[string]$Labels,
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidateSet('ChangeRequest','ContractItem','PlatformImprovement','ReleaseDelivery','StrategicRoadmap','Support')]
|
||
|
[string]$IssueSource = 'PlatformImprovement',
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidateSet('Analytics','Architecture','AutomationTooling','CodeCleanup','Componentization','DevStandards','Documentation','Logging','PerformanceOptimization','Security','Strategic','Supportability','UnitTesting')]
|
||
|
[string]$RequestType = 'DevStandards',
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidateSet('None','Dev','QA','Staging','Production')]
|
||
|
[string]$EnvironmentFoundIn = 'None',
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidateSet('AccountsAggregation','AccountsCertificateMaturityOptions','AccountsCheckImaging','AccountsNative','AccountsQuickenandQuickbooks','AccountsTransactionDispute','AccountsTransactionEnrichmentTDE','Accounts','API','ApplicationsWidget','Benefits','BillPay','Billing','Budgets','BusinessACH','BusinessAdmin','BusinessReports','BusinessRiskMitigation','BusinessWires','CalculatorCalendar','CardManagementDigitalCards','CardManagement','CardlessCash','Chat','Content','ConversationalBanking','CoreCorelationKeystone','CoreCUFX','CoreD+H/HFSPhoenixXM','CoreD+H/HFSUltradata','CoreDataeXchange','CoreDesertESB','CoreDMI','CoreEpisysSymConnect','CoreEpisysSymXchange','CoreFICSRTA','CoreFirstTech','CoreFISBase2000','CoreFISCreditCards','CoreFISHorizonCodeConnect','CoreFISMISER','CoreFISPaymentsOne','CoreFiservCCM','CoreFiservCoACCM','CoreFiservDNACoreAPI','CoreFiservDNAIRB','CoreFiservOmaha','CoreFiservXP2Apex','CoreFiserv/ITICoA','CoreiPower','CoreMortgageBatch','CoreOCCUESB','CoreOrion','CoreOTSESB','CoreSalesforce','CoreSandiaLabsESB','CoreSilverlake','CoreSpectrumPathways','CoreSTCUESB','CoreThoughtMachine','CoreTMGODS','CourtesyPay','CreditScoreFICO','CreditScoreSavvyMoney','Cryptocurrency','CustomBaxter','CustomCivicRewards','CustomFirstFlorida','CustomIdahoCentral','CustomMACU','CustomMission','CustomOregonCommunityRewards','CustomPatelco','CustomSandiaLabs','CustomSPIRECharity','CustomUSF','Dashboard','DigitalID','DraftServices','eDocuments','FinancialWellness','Flux','Ignite','InstantAccountVerificationIAV','InternalTools','Investments','Iris','LoanCoupon','Locations','MessageCenter','MultiLanguage','N/A','Navigation','NotificationDeliveryPush','NotificationDelivery','OverdraftProtection','P2PZelle','PayrollDistribution','Platform','QuickApply','RDC','RetailWires','SavingsGoals','SDK','SecurityBioCatch','SecurityCyxteraDetectTA','SecurityIntegratedAdminAuthentication','SecurityTokens','Security','SecurityAPI','SharedAccess','SkipAPay','SSOBillPay','SSOsAccountOpening','SSOsAccounts','SSOsBenefits','SSOsBusinessAdmin','SSOsCardManagement','SSOsDocumentRepository','SSOsDraftServices','SSOseDocs','SSOsP2P','SSOsRDC','SSOsSkipaPay','Themes','TransactionDownload','Transfers','UserManagement','UserSentiment','UserServices','WebAnalytics')]
|
||
|
[string]$Component = 'Platform',
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[ValidatePattern('^[A-Z]+-[0-9]+$')]
|
||
|
[string]$EpicTicketId
|
||
|
)
|
||
|
# $issueSourceValue = Get-IssueSourceValue -Value
|
||
|
$issueSourceValue = switch ($IssueSource) {
|
||
|
'ChangeRequest' { '12706' }
|
||
|
'ContractItem' { '12705' }
|
||
|
'PlatformImprovement' { '11004' }
|
||
|
'ReleaseDelivery' { '13405' }
|
||
|
'StrategicRoadmap' { '11005' }
|
||
|
'Support' { '11006' }
|
||
|
}
|
||
|
|
||
|
$requestTypeValue = switch ($RequestType) {
|
||
|
'Analytics' { 24101 }
|
||
|
'Architecture' { 24302 }
|
||
|
'AutomationTooling' { 24303 }
|
||
|
'CodeCleanup' { 24103 }
|
||
|
'Componentization' { 24104 }
|
||
|
'DevStandards' { 24105 }
|
||
|
'Documentation' { 24106 }
|
||
|
'Logging' { 24107 }
|
||
|
'PerformanceOptimization' { 24108 }
|
||
|
'Security' { 24304 }
|
||
|
'Strategic' { 24109 }
|
||
|
'Supportability' { 24102 }
|
||
|
'UnitTesting' { 24110 }
|
||
|
}
|
||
|
|
||
|
$environmentFoundInValue = switch ($EnvironmentFoundIn) {
|
||
|
'Dev' { '18241' }
|
||
|
'QA' { '18242' }
|
||
|
'Staging' { '18243' }
|
||
|
'Production' { '12006' }
|
||
|
default { $null }
|
||
|
}
|
||
|
|
||
|
$componentsValue = switch ($Component) {
|
||
|
'AccountsAggregation' { '20805' }
|
||
|
'AccountsCertificateMaturityOptions' { '28967' }
|
||
|
'AccountsCheckImaging' { '14125' }
|
||
|
'AccountsNative' { '24203' }
|
||
|
'AccountsQuickenandQuickbooks' { '28966' }
|
||
|
'AccountsTransactionDispute' { '19906' }
|
||
|
'AccountsTransactionEnrichmentTDE' { '22000' }
|
||
|
'Accounts' { '22415' }
|
||
|
'API' { '23018' }
|
||
|
'ApplicationsWidget' { '14445' }
|
||
|
'Benefits' { '23744' }
|
||
|
'BillPay' { '19601' }
|
||
|
'Billing' { '22004' }
|
||
|
'Budgets' { '14404' }
|
||
|
'BusinessACH' { '16222' }
|
||
|
'BusinessAdmin' { '23016' }
|
||
|
'BusinessReports' { '23017' }
|
||
|
'BusinessRiskMitigation' { '28970' }
|
||
|
'BusinessWires' { '17214' }
|
||
|
'CalculatorCalendar' { '14609' }
|
||
|
'CardManagementDigitalCards' { '88273' }
|
||
|
'CardManagement' { '19815' }
|
||
|
'CardlessCash' { '61578' }
|
||
|
'Chat' { '14170' }
|
||
|
'Content' { '19904' }
|
||
|
'ConversationalBanking' { '28963' }
|
||
|
'CoreCorelationKeystone' { '14190' }
|
||
|
'CoreCUFX' { '24403' }
|
||
|
'CoreD+H/HFSPhoenixXM' { '14187' }
|
||
|
'CoreD+H/HFSUltradata' { '14185' }
|
||
|
'CoreDataeXchange' { '19981' }
|
||
|
'CoreDesertESB' { '18004' }
|
||
|
'CoreDMI' { '29567' }
|
||
|
'CoreEpisysSymConnect' { '22420' }
|
||
|
'CoreEpisysSymXchange' { '23762' }
|
||
|
'CoreFICSRTA' { '21403' }
|
||
|
'CoreFirstTech' { '21700' }
|
||
|
'CoreFISBase2000' { '61925' }
|
||
|
'CoreFISCreditCards' { '14516' }
|
||
|
'CoreFISHorizonCodeConnect' { '93400' }
|
||
|
'CoreFISMISER' { '15816' }
|
||
|
'CoreFISPaymentsOne' { '89590' }
|
||
|
'CoreFiservCCM' { '23106' }
|
||
|
'CoreFiservCoACCM' { '30667' }
|
||
|
'CoreFiservDNACoreAPI' { '18908' }
|
||
|
'CoreFiservDNAIRB' { '14188' }
|
||
|
'CoreFiservOmaha' { '71317' }
|
||
|
'CoreFiservXP2Apex' { '14186' }
|
||
|
'CoreFiserv/ITICoA' { '23765' }
|
||
|
'CoreiPower' { '14604' }
|
||
|
'CoreMortgageBatch' { '14249' }
|
||
|
'CoreOCCUESB' { '20408' }
|
||
|
'CoreOrion' { '27602' }
|
||
|
'CoreOTSESB' { '19982' }
|
||
|
'CoreSalesforce' { '61397' }
|
||
|
'CoreSandiaLabsESB' { '19300' }
|
||
|
'CoreSilverlake' { '19980' }
|
||
|
'CoreSpectrumPathways' { '14189' }
|
||
|
'CoreSTCUESB' { '23774' }
|
||
|
'CoreThoughtMachine' { '83561' }
|
||
|
'CoreTMGODS' { '21404' }
|
||
|
'CourtesyPay' { '21608' }
|
||
|
'CreditScoreFICO' { '23400' }
|
||
|
'CreditScoreSavvyMoney' { '28000' }
|
||
|
'Cryptocurrency' { '73700' }
|
||
|
'CustomBaxter' { '23107' }
|
||
|
'CustomCivicRewards' { '24100' }
|
||
|
'CustomFirstFlorida' { '23404' }
|
||
|
'CustomIdahoCentral' { '22911' }
|
||
|
'CustomMACU' { '23104' }
|
||
|
'CustomMission' { '24404' }
|
||
|
'CustomOregonCommunityRewards' { '61393' }
|
||
|
'CustomPatelco' { '20900' }
|
||
|
'CustomSandiaLabs' { '21405' }
|
||
|
'CustomSPIRECharity' { '30669' }
|
||
|
'CustomUSF' { '24306' }
|
||
|
'Dashboard' { '23734' }
|
||
|
'DigitalID' { '61394' }
|
||
|
'DraftServices' { '14345' }
|
||
|
'eDocuments' { '14194' }
|
||
|
'FinancialWellness' { '42271' }
|
||
|
'Flux' { '23702' }
|
||
|
'Ignite' { '81301' }
|
||
|
'InstantAccountVerificationIAV' { '78025' }
|
||
|
'InternalTools' { '19901' }
|
||
|
'Investments' { '14500' }
|
||
|
'Iris' { '24304' }
|
||
|
'LoanCoupon' { '16501' }
|
||
|
'Locations' { '14511' }
|
||
|
'MessageCenter' { '23737' }
|
||
|
'MultiLanguage' { '28962' }
|
||
|
'N/A' { '24209' }
|
||
|
'Navigation' { '83560' }
|
||
|
'NotificationDeliveryPush' { '15600' }
|
||
|
'NotificationDelivery' { '20022' }
|
||
|
'OverdraftProtection' { '19819' }
|
||
|
'P2PZelle' { '14256' }
|
||
|
'PayrollDistribution' { '20803' }
|
||
|
'Platform' { '13607' }
|
||
|
'QuickApply' { '19792' }
|
||
|
'RDC' { '23117' }
|
||
|
'RetailWires' { '20505' }
|
||
|
'SavingsGoals' { '17217' }
|
||
|
'SDK' { '15282' }
|
||
|
'SecurityBioCatch' { '80984' }
|
||
|
'SecurityCyxteraDetectTA' { '28964' }
|
||
|
'SecurityIntegratedAdminAuthentication' { '28969' }
|
||
|
'SecurityTokens' { '28965' }
|
||
|
'Security' { '14506' }
|
||
|
'SecurityAPI' { '28961' }
|
||
|
'SharedAccess' { '23303' }
|
||
|
'SkipAPay' { '21606' }
|
||
|
'SSOBillPay' { '41803' }
|
||
|
'SSOsAccountOpening' { '23105' }
|
||
|
'SSOsAccounts' { '27400' }
|
||
|
'SSOsBenefits' { '23014' }
|
||
|
'SSOsBusinessAdmin' { '23703' }
|
||
|
'SSOsCardManagement' { '23407' }
|
||
|
'SSOsDocumentRepository' { '67201' }
|
||
|
'SSOsDraftServices' { '14176' }
|
||
|
'SSOseDocs' { '14198' }
|
||
|
'SSOsP2P' { '14257' }
|
||
|
'SSOsRDC' { '18303' }
|
||
|
'SSOsSkipaPay' { '23405' }
|
||
|
'Themes' { '14322' }
|
||
|
'TransactionDownload' { '21609' }
|
||
|
'Transfers' { '22900' }
|
||
|
'UserManagement' { '20807' }
|
||
|
'UserSentiment' { '26500' }
|
||
|
'UserServices' { '22500' }
|
||
|
'WebAnalytics' { '81620' }
|
||
|
}
|
||
|
|
||
|
$teamTranslation = switch ($Team) {
|
||
|
'AI' { 'Account Intelligence' }
|
||
|
'AS' { 'Account Services' }
|
||
|
'AV' { 'Analytics Visualization' }
|
||
|
'BIZPAY' { 'Business Payments' }
|
||
|
'BIZSVC' { 'Business Services' }
|
||
|
'CE' { 'Card Experience' }
|
||
|
'CORECUSTOM' { 'Core Custom' }
|
||
|
'CORE' { 'Core Standard' }
|
||
|
'DE' { 'Data Engine' }
|
||
|
'Mobile' { 'Mobile Platform' }
|
||
|
'Android' { 'Native Mobile Android' }
|
||
|
'iOS' { 'Native Mobile iOS' }
|
||
|
'PLAT' { 'PlatformB' }
|
||
|
'COM' { 'Vanguard' }
|
||
|
'ARCH' { 'Vanguard' }
|
||
|
'BIZDATABILLING' { 'WidgetsD' }
|
||
|
'WIDD' { 'Carbon' }
|
||
|
'TI' { 'Implementation Services' }
|
||
|
'FS' { 'Fraud & Security' }
|
||
|
'CS' { 'Customer Service' }
|
||
|
default { $Team }
|
||
|
}
|
||
|
|
||
|
$teamValue = switch ($teamTranslation) {
|
||
|
'Account Intelligence' { 60 }
|
||
|
'Account Services' { '133' }
|
||
|
'Analytics Visualization' { '124' }
|
||
|
'API' { '52' }
|
||
|
'Business Payments' { '115' }
|
||
|
'Business Services' { '116' }
|
||
|
'Carbon' { '96' }
|
||
|
'Card Experience' { '134' }
|
||
|
'Core Custom' { '63' }
|
||
|
'Core Standard' { '64' }
|
||
|
'Customer Service' { '136' }
|
||
|
'Data Engine' { '123' }
|
||
|
'Fraud & Security' { '137' }
|
||
|
'Ignite' { '148' }
|
||
|
'Implementation Services' { '34' }
|
||
|
'MMA' { '47' }
|
||
|
'MMC' { '85' }
|
||
|
'Mobile Platform' { '132' }
|
||
|
'Native Mobile Android' { '86' }
|
||
|
'Native Mobile iOS' { '24' }
|
||
|
'PlatformB' { '66' }
|
||
|
'SDK' { '53' }
|
||
|
'Sidekick' { '126' }
|
||
|
'Steam' { '131' }
|
||
|
'Sustained Development' { '19' }
|
||
|
'Vanguard' { '79' }
|
||
|
'WidgetsD' { '45' }
|
||
|
}
|
||
|
|
||
|
$issueSourceField = 'customfield_11200'
|
||
|
$requestTypeField = 'customfield_17000'
|
||
|
$environmentFoundInField = 'customfield_12001'
|
||
|
$teamsField = 'customfield_10108'
|
||
|
$epicField = 'customfield_10405'
|
||
|
$customerField = 'customfield_12005'
|
||
|
$naCustomerId = '14408' # N/A
|
||
|
$devProjectId = '11000' # This means "DEV" project
|
||
|
$devIssueTypeStory = '10601' # This means "Story"
|
||
|
|
||
|
$message = @{
|
||
|
fields = @{
|
||
|
project = @{
|
||
|
id = $devProjectId
|
||
|
}
|
||
|
issuetype = @{
|
||
|
id = $devIssueTypeStory
|
||
|
}
|
||
|
summary = $Summary
|
||
|
# According to the documentation, I can just encode text here (possibly replacing newlines with `n)
|
||
|
description = $Body
|
||
|
components = @(
|
||
|
@{
|
||
|
id = $componentsValue
|
||
|
}
|
||
|
)
|
||
|
$customerField = @(
|
||
|
@{
|
||
|
id = $naCustomerId
|
||
|
}
|
||
|
)
|
||
|
$issueSourceField = @{
|
||
|
value = 'Platform Improvement'
|
||
|
}
|
||
|
$requestTypeField = @{
|
||
|
value = 'Componentization'
|
||
|
}
|
||
|
$teamsField = $teamTranslation
|
||
|
<# @{
|
||
|
id = $teamValue
|
||
|
key = $teamValue
|
||
|
# key = $teamTranslation
|
||
|
}#>
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ($null -ne $environmentFoundInValue) {
|
||
|
$message.fields[$environmentFoundInField] = $environmentFoundInValue
|
||
|
}
|
||
|
|
||
|
if (![string]::IsNullOrWhiteSpace($Labels)) {
|
||
|
$message.fields['labels'] = @( $Labels -split ',' )
|
||
|
}
|
||
|
|
||
|
if (![string]::IsNullOrWhiteSpace($EpicTicketId)) {
|
||
|
$message.fields[$epicField] = $EpicTicketId
|
||
|
}
|
||
|
|
||
|
$payload = (ConvertTo-Json $message -Depth 10 -Compress)
|
||
|
Write-Host $payload
|
||
|
|
||
|
|
||
|
$url = (Get-JiraBaseUrl)
|
||
|
$headers = (Get-JiraBearerTokenAuthWebHeader)
|
||
|
$headers["Content-Type"] = "application/json"
|
||
|
$headers["Accept"] = "application/json"
|
||
|
|
||
|
$jiraUrlMetaCreateFields = (Join-UrlComponents -BaseUrl $url -Path "/rest/api/latest/issue/")
|
||
|
|
||
|
$arguments = @{
|
||
|
Headers = $headers
|
||
|
Uri = $jiraUrlMetaCreateFields
|
||
|
Method = 'POST'
|
||
|
Body = $payload
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
$response = Invoke-RestMethod @arguments
|
||
|
return $response
|
||
|
} catch {
|
||
|
Write-Host (Get-LastWebRequestErrorText)
|
||
|
Write-ErrorObject -ErrorItem $PSItem
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
|
||
|
<#
|
||
|
|
||
|
#>
|