Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Incident Custom Fields and sanitize Orchestration PUT request #139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pagerduty/event_orchestration_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ type EventOrchestrationPathRuleActions struct {
Annotate string `json:"annotate"`
PagerdutyAutomationActions []*EventOrchestrationPathPagerdutyAutomationAction `json:"pagerduty_automation_actions"`
AutomationActions []*EventOrchestrationPathAutomationAction `json:"automation_actions"`
IncidentCustomFieldUpdates []*EventOrchestrationPathIncidentCustomFieldUpdate `json:"incident_custom_field_updates"`
Severity string `json:"severity"`
EventAction string `json:"event_action"`
Variables []*EventOrchestrationPathActionVariables `json:"variables"`
Extractions []*EventOrchestrationPathActionExtractions `json:"extractions"`
}

type EventOrchestrationPathIncidentCustomFieldUpdate struct {
ID string `json:"id,omitempty"`
Value string `json:"value,omitempty"`
}

type EventOrchestrationPathPagerdutyAutomationAction struct {
ActionId string `json:"action_id,omitempty"`
}
Expand Down
30 changes: 28 additions & 2 deletions pagerduty/event_orchestration_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ func TestEventOrchestrationPathGlobalUpdate(t *testing.T) {
ID: "4ad2c1be",
Label: "business hours",
},
{
Actions: &EventOrchestrationPathRuleActions{
IncidentCustomFieldUpdates: []*EventOrchestrationPathIncidentCustomFieldUpdate{
{
ID: "PN1C4A2",
Value: "{{event.timestamp}}",
},
},
},
Label: "Set Impact Start custom field from event",
ID: "yu3bv02m",
Conditions: []*EventOrchestrationPathRuleCondition{},
},
},
},
{
Expand Down Expand Up @@ -408,6 +421,19 @@ func TestEventOrchestrationPathGlobalUpdate(t *testing.T) {
"conditions": [{"expression": "now in Mon,Tue,Wed,Thu,Fri 08:00:00 to 18:00:00 America/Los_Angeles"}],
"id": "4ad2c1be",
"label": "business hours"
},
{
"label": "Set Impact Start custom field from event",
"id": "yu3bv02m",
"conditions": [],
"actions": {
"incident_custom_field_updates": [
{
"id": "PN1C4A2",
"value": "{{event.timestamp}}"
}
]
}
}
]
},
Expand Down Expand Up @@ -601,14 +627,14 @@ func TestEventOrchestrationPathUnroutedUpdate(t *testing.T) {
},
},
Warnings: []*EventOrchestrationPathWarning{
&EventOrchestrationPathWarning{
imjaroiswebdev marked this conversation as resolved.
Show resolved Hide resolved
{
Feature: "variables",
FeatureType: "actions",
Message: "Message 1",
RuleId: "abcd001",
WarningType: "forbidden_feature",
},
&EventOrchestrationPathWarning{
{
Feature: "extractions",
FeatureType: "actions",
Message: "Message 2",
Expand Down
Loading