PagerDuty / go-pagerduty

go client library for PagerDuty v2 API
https://v2.developer.pagerduty.com/docs/rest-api
Apache License 2.0
287 stars 240 forks source link

Support for creating Event Rules with "Template Extractions", via go-client library #421

Open ricardoasmarques opened 2 years ago

ricardoasmarques commented 2 years ago

According to the API documentation, it's possible to create an "Event Rule Extraction" using a template (instead of a regex):

Screenshot from 2022-02-07 11-39-49

This same option is available when creating an Event Rule via UI;

Screenshot from 2022-02-07 11-41-21

But It's not possible to do it via go-client library:

Screenshot from 2022-02-07 11-45-19

Is it possible to add support for creating "Event Rule Extraction" using a template, via go-client library?

theckman commented 2 years ago

@ricardoasmarques can you please point me more precisely within the documentation where it says a template can be used? I took a look at the link, expanded all fields, and do not see template anywhere on the page.

The reason I ask is that a requirement for functionality being added to this package is that it's clearly documented on that API docs site.

theckman commented 2 years ago

Also, sorry for not replying sooner. I somehow missed this issue. 🤦‍♂️

ricardoasmarques commented 2 years ago

@theckman it's a bit hidden in the documentation.

You have to navigate to https://developer.pagerduty.com/api-reference/b3A6Mjc0ODIwNw-create-an-event-rule-on-a-service and then expand rule > actions > extractions, then you will see a dropdown next to the extractions field:

Screenshot from 2022-03-21 08-59-41

Select the second option on that dropdown, and you will see the documentation for template:

Screenshot from 2022-03-21 09-06-33

theckman commented 2 years ago

Yikes. So looking at that we're probably going need a breaking change to support this. 🤦 I guess we could add the field, and add a check for both target and regex being set... if so then return an error.