-
Notifications
You must be signed in to change notification settings - Fork 55
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
[PLGN-362]- Pager Duty - Refactor to use requests rather than pypd #2033
Conversation
plugins/pagerduty/komand_pagerduty/actions/create_user/action.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/create_user/action.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/delete_user_by_id/action.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/create_user/action.py
Outdated
Show resolved
Hide resolved
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.
Some more changes while I get through the rest
plugins/pagerduty/komand_pagerduty/actions/create_user/action.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/get_on_call/action.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/send_trigger_event/action.py
Outdated
Show resolved
Hide resolved
17c170b
to
a8259df
Compare
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.
I just left 🔴 for any areas I felt contained sensitive info that need updated in the plugin.spec.yaml
Refer to the style guide for input examples we use:
https://docs.rapid7.com/insightconnect/style-guide#input-examples
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.
Minor tidy up comments, and looks like the get use by email action could still be supported? If that query parameter doesn't work, we could try a call to the endpoint with high limits (1000?) and search the users that are returned to get the user? I'm guessing on most workflows that this would be a common first step to get the user ID to feed into next steps.
plugins/pagerduty/komand_pagerduty/actions/create_user/schema.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/send_trigger_event/schema.py
Outdated
Show resolved
Hide resolved
plugins/pagerduty/komand_pagerduty/actions/send_trigger_event/schema.py
Outdated
Show resolved
Hide resolved
5a1118c
to
2c9133c
Compare
plugins/pagerduty/komand_pagerduty/actions/send_acknowledge_event/action.py
Show resolved
Hide resolved
…ing redunant checks for required fields
…tconnect_plugin_runtime.exceptions
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
…2033) (#2103) * PLGN-362-Updating pager duty to use http rather than pypd * PLGN-362-Reducing complexity of get_on_calls method and send_request method * PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields * PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions * PLGN-362-Removing redunant required check * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Adding docstrings, using the input object in the connection class * PLGN-362-Running black formatter on get_on_call and util/api * PLGN-362-Updating docstrings to use sphinx format * PLGN-362-Updating examples to user real fake data * PLGN-362-Updating black format * PLGN-362-Making sure return for delete is of type string * PLGN-362-Making sure return for delete is of type string * PLGN-362-Fixing typos / tidying up code * PLGN-362-Adding back in get user by email action + tests * PLGN-362-using black format * PLGN-362-adding back in prefix to eah actions description
Proposed Changes
Description
https://issues.corp.rapid7.com/browse/PLGN-362
The current version of the plugin uses the PYPD package to make calls to the pager duty api (https://github.com/PagerDuty/pagerduty-api-python-client) this has been deprecated for a while and some of the calls are no longer working
Describe the proposed changes:
get_user_by_email
as this does not seem to be supported via an http request, user info can still be fetched via user IDPR Requirements
Developers, verify you have completed the following items by checking them off:
Testing
All of the actions have been tested locally in a docker container using postman to create the requests and the outputs have been verified when looking at the pager duty UI
Unit Tests
new unit tests have been added for all actions
Review our documentation on generating and writing plugin unit tests
In-Product Tests
If you are an InsightConnect customer or have access to an InsightConnect instance, the following in-product tests should be done:
Style
Review the style guide
USER nobody
in theDockerfile
when possiblerapid7/insightconnect-python-3-38-slim-plugin:{sdk-version-num}
andrapid7/insightconnect-python-3-38-plugin:{sdk-version-num}
insight-plugin validate
which callsicon_validate
to linthelp.md
Functional Checklist
tests/
directory created withinsight-plugin samples
tests/$action_bad.json
insight-plugin run -T tests/example.json --debug --jq
insight-plugin run -T all --debug --jq
(use PR format at end)insight-plugin run -R tests/example.json --debug --jq
insight-plugin run --debug --jq
(use PR format at end)Assessment
You must validate your work to reviewers:
insight-plugin validate
and make sure everything passesinsight-plugin run -A
. For single action validation:insight-plugin run tests/{file}.json -A
insight-plugin ... | pbcopy
) and paste the output in a new post on this PR