Skip to content

Commit

Permalink
Merge pull request #977 from c-kaieong/ORCA-5142-add-deprecation-warn…
Browse files Browse the repository at this point in the history
…ing-for-route-to

[ORCA-5142] Add deprecation warning for the route_to action within a Service Orchestration catch-all rule
  • Loading branch information
cjgajard authored Feb 6, 2025
2 parents 03c0aed + 032997a commit 383457c
Showing 1 changed file with 77 additions and 73 deletions.
150 changes: 77 additions & 73 deletions pagerduty/resource_pagerduty_event_orchestration_path_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,90 +13,94 @@ import (
"github.com/heimweh/go-pagerduty/pagerduty"
)

var eventOrchestrationPathServiceCatchAllActionsSchema = map[string]*schema.Schema{
"suppress": {
Type: schema.TypeBool,
Optional: true,
},
"suspend": {
Type: schema.TypeInt,
Optional: true,
},
"priority": {
Type: schema.TypeString,
Optional: true,
},
"annotate": {
Type: schema.TypeString,
Optional: true,
},
"pagerduty_automation_action": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"action_id": {
Type: schema.TypeString,
Required: true,
func buildEventOrchestrationPathServiceCatchAllActionsSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"suppress": {
Type: schema.TypeBool,
Optional: true,
},
"suspend": {
Type: schema.TypeInt,
Optional: true,
},
"priority": {
Type: schema.TypeString,
Optional: true,
},
"annotate": {
Type: schema.TypeString,
Optional: true,
},
"pagerduty_automation_action": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"action_id": {
Type: schema.TypeString,
Required: true,
},
},
},
},
},
"automation_action": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: eventOrchestrationAutomationActionSchema,
"automation_action": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: eventOrchestrationAutomationActionSchema,
},
},
"severity": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: validateEventOrchestrationPathSeverity(),
},
"event_action": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: validateEventOrchestrationPathEventAction(),
},
"variable": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationPathVariablesSchema,
},
},
"extraction": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationPathExtractionsSchema,
},
},
},
"severity": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: validateEventOrchestrationPathSeverity(),
},
"event_action": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: validateEventOrchestrationPathEventAction(),
},
"variable": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationPathVariablesSchema,
"incident_custom_field_update": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationIncidentCustomFieldsObjectSchema,
},
},
},
"extraction": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationPathExtractionsSchema,
"escalation_policy": {
Type: schema.TypeString,
Optional: true,
},
},
"incident_custom_field_update": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: eventOrchestrationIncidentCustomFieldsObjectSchema,
"route_to": {
Type: schema.TypeString,
Deprecated: "The 'route_to' attribute is no longer supported for catch-all rules.",
Optional: true,
},
},
"escalation_policy": {
Type: schema.TypeString,
Optional: true,
},
}
}

var eventOrchestrationPathServiceRuleActionsSchema = buildEventOrchestrationPathServiceRuleActionsSchema()
var eventOrchestrationPathServiceCatchAllActionsSchema = buildEventOrchestrationPathServiceCatchAllActionsSchema()

func buildEventOrchestrationPathServiceRuleActionsSchema() map[string]*schema.Schema {
a := eventOrchestrationPathServiceCatchAllActionsSchema
a["route_to"] = &schema.Schema{
Type: schema.TypeString,
Optional: true,
}

a := buildEventOrchestrationPathServiceCatchAllActionsSchema()
a["route_to"].Deprecated = ""
return a
}

Expand Down Expand Up @@ -178,7 +182,7 @@ func resourcePagerDutyEventOrchestrationPathService() *schema.Resource {
Required: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: eventOrchestrationPathServiceRuleActionsSchema,
Schema: eventOrchestrationPathServiceCatchAllActionsSchema,
},
},
},
Expand Down

0 comments on commit 383457c

Please sign in to comment.