Skip to content

Commit

Permalink
Merge pull request #139 from swbradshaw/ORCA-4262/custom_fields_action
Browse files Browse the repository at this point in the history
Add support for Incident Custom Fields and sanitize Orchestration PUT request
  • Loading branch information
imjaroiswebdev authored Feb 26, 2024
2 parents a2cbd99 + 737736f commit bfc8dce
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
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{
{
Feature: "variables",
FeatureType: "actions",
Message: "Message 1",
RuleId: "abcd001",
WarningType: "forbidden_feature",
},
&EventOrchestrationPathWarning{
{
Feature: "extractions",
FeatureType: "actions",
Message: "Message 2",
Expand Down

0 comments on commit bfc8dce

Please sign in to comment.