ReceivedErrorKeyMetadata is ErrorKeyMetadata as received from
the metadata.yaml file
|
type ReceivedErrorKeyMetadata struct {
Description string `yaml:"description" json:"description"`
Impact string `yaml:"impact" json:"impact"`
Likelihood int `yaml:"likelihood" json:"likelihood"`
PublishDate string `yaml:"publish_date" json:"publish_date"`
ResolutionRisk string `yaml:"resolution_risk" json:"resolution_risk"`
Status string `yaml:"status" json:"status"`
Tags [ ] string `yaml:"tags" json:"tags"`
}
|
ToErrorKeyMetadata converts ReceivedErrorKeyMetadata to the type actually
used by the pipeline, calculating impact with impactDict and resolution_risk
with resolutionRiskDict
|
func ( r ReceivedErrorKeyMetadata ) ToErrorKeyMetadata (
impactDict map [ string ] int ,
resolutionRiskDict map [ string ] int ,
) types . ErrorKeyMetadata {
returnVal := types . ErrorKeyMetadata { }
returnVal . Description = r . Description
impactValue , found := impactDict [ r . Impact ]
if ! found {
log . Warn ( ) . Str ( "impact" , r . Impact ) . Msg ( `impact doesn't have integer representation` )
}
returnVal . Impact . Impact = impactValue
returnVal . Impact . Name = r . Impact
resolutionRiskValue , found := resolutionRiskDict [ r . ResolutionRisk ]
if ! found {
log . Warn ( ) . Str ( "resolution risk" , r . ResolutionRisk ) . Msg ( `resolution_risk doesn't have integer representation` )
}
returnVal . ResolutionRisk = resolutionRiskValue
returnVal . Likelihood = r . Likelihood
returnVal . PublishDate = r . PublishDate
returnVal . Status = r . Status
returnVal . Tags = r . Tags
return returnVal
}
|