Skip to content

Commit

Permalink
fix(cli): missing fields for Slack integrations (#170)
Browse files Browse the repository at this point in the history
Contributes to #169

Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune authored Jul 20, 2020
1 parent a072c46 commit a8ce9a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/integrations_slack_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ type SlackChanIntegration struct {
}

type SlackChannelData struct {
IssueGrouping string `json:"ISSUE_GROUPING,omitempty"`
SlackUrl string `json:"SLACK_URL"`
MinAlertSeverity SlackAlertLevel `json:"MIN_ALERT_SEVERITY"`
IssueGrouping string `json:"ISSUE_GROUPING,omitempty" mapstructure:"ISSUE_GROUPING"`
SlackUrl string `json:"SLACK_URL" mapstructure:"SLACK_URL"`
MinAlertSeverity SlackAlertLevel `json:"MIN_ALERT_SEVERITY" mapstructure:"MIN_ALERT_SEVERITY"`
}
20 changes: 20 additions & 0 deletions cli/cmd/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,26 @@ func reflectIntegrationData(raw api.RawIntegration) [][]string {
}
return out

case api.SlackChannelIntegration.String():

var iData api.SlackChannelData
err := mapstructure.Decode(raw.Data, &iData)
if err != nil {
cli.Log.Debugw("unable to decode integration data",
"integration_type", raw.Type,
"raw_data", raw.Data,
"error", err,
)
break
}
out := [][]string{
[]string{"SLACK URL", iData.SlackUrl},
[]string{"ISSUE GROUPING", iData.IssueGrouping},
[]string{"ALERT ON SEVERITY", iData.MinAlertSeverity.String()},
}

return out

default:
out := [][]string{}
for key, value := range deepKeyValueExtract(raw.Data) {
Expand Down

0 comments on commit a8ce9a9

Please sign in to comment.