-
Notifications
You must be signed in to change notification settings - Fork 72
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
Events API v2 Support #84
base: master
Are you sure you want to change the base?
Conversation
Created Events class compatible with Events API v2 (not to be confused with REST API v2) New API comes with new documented required fields and new optional fields. Documentation links provided at top of code for reference to the PD-CEF & Events API v2 Implemented enqueue() to allow for payload to be specified by caller. This allows direct use of the JSON produced for the request (better for unit-testing enqueue function) Note that summary/source/severity are still required, and throw a KeyError if not found in either kwargs or payload.
Similar to v1 test: directly tests the enqueue() function with a built-in event_action of "trigger"
https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2 Shows 'images' and 'links' outside of payload.
@cugini-dbx any thing blocking this PR from getting merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in review. I just have one small comment around a some required field validation, otherwise it looks good to me!
pygerduty/events_v2.py
Outdated
# Required (according to documentation) PD-CEF fields | ||
data = {"event_action": kwargs['event_action']} | ||
data['payload'] = kwargs.get('payload', {}) | ||
for key in ['summary', 'source', 'severity']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A teammate pointed out that payload
is optional, but looks like this assumes payload is required (by checking for these three keys).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. 👍
Even though payload is now optional, if it is specified, the fields within it are still checked as required
The rest of the Travis issues appear to be not associated with this PR... not sure how best to resolve them |
looks at watch |
|
Hello, I'm interested in this feature. Regards, |
No description provided.