Skip to content

Commit 574ea3f

Browse files
rbowden-r7ablakley-r7
authored andcommitted
[PLGN-362]- Pager Duty - Refactor to use requests rather than pypd (#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
1 parent a69f81a commit 574ea3f

File tree

84 files changed

+4795
-1641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4795
-1641
lines changed

plugins/pagerduty/.CHECKSUM

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
{
2-
"spec": "f20c11c35f0dbd45c4ae3207b10029b4",
3-
"manifest": "322935ff822e9be3217f4e2227e9a00f",
4-
"setup": "4a6275a7299d3b5523ecadf7ab8a163a",
2+
"spec": "6527a68d9fd5097bbb7075b8b279d9b8",
3+
"manifest": "825be40acb77734dcd402f0da001f41b",
4+
"setup": "a4f3b2fabe8b53ce95d26b7439c5d3a8",
55
"schemas": [
66
{
77
"identifier": "create_user/schema.py",
8-
"hash": "d20d7c28c305fdcebb96939510679ae7"
8+
"hash": "c68031209d4fa67ccb59d29e2d9129a0"
99
},
1010
{
1111
"identifier": "delete_user_by_id/schema.py",
12-
"hash": "55d6f98c36228cc8b294303f54eae49c"
12+
"hash": "796c3831d82077d659ebc859897d3410"
1313
},
1414
{
1515
"identifier": "get_on_call/schema.py",
16-
"hash": "4eb592192c18a8e0a79bd263a2509e29"
16+
"hash": "136d6977b7cf82f1d59f6affa2f3112c"
1717
},
1818
{
1919
"identifier": "get_user_by_email/schema.py",
20-
"hash": "79d23d5f0c61caa02bb2728c940e4503"
20+
"hash": "ca70ed41b688a0648c824a649c5072ff"
2121
},
2222
{
2323
"identifier": "get_user_by_id/schema.py",
24-
"hash": "43da47a5a74bc83c3652b398f29db719"
24+
"hash": "78552441f46e278e02110bb7742d67ac"
2525
},
2626
{
2727
"identifier": "send_acknowledge_event/schema.py",
28-
"hash": "24b59e94be441385f0ce8770647cfa60"
28+
"hash": "29ad62b147f212b81ae75380983190b8"
2929
},
3030
{
3131
"identifier": "send_resolve_event/schema.py",
32-
"hash": "74ea18af0ba61eb8dc40923971eb7d85"
32+
"hash": "139114bf8815c249bac54e8ed9b61ad2"
3333
},
3434
{
3535
"identifier": "send_trigger_event/schema.py",
36-
"hash": "2a003fe3014831f80493498c143d302f"
36+
"hash": "60c41049677bc3b99a28a2b941239d17"
3737
},
3838
{
3939
"identifier": "connection/schema.py",
40-
"hash": "80f4aea21f43406ebe4afe09f912b280"
40+
"hash": "222cae0befdc90d883e5d25ea004a33d"
4141
}
4242
]
4343
}

plugins/pagerduty/Dockerfile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
FROM rapid7/insightconnect-python-3-38-slim-plugin:4
2-
# The three supported python parent images are:
3-
# - komand/python-2-plugin
4-
# - komand/python-3-plugin
5-
# - komand/python-pypy3-plugin
6-
#
7-
# Update the tag to a full semver version
1+
FROM rapid7/insightconnect-python-3-38-plugin:5
82

9-
# Add any custom package dependencies here
10-
# NOTE: Add pip packages to requirements.txt
3+
LABEL organization=rapid7
4+
LABEL sdk=python
115

12-
# End package dependencies
13-
14-
# Add source code
156
WORKDIR /python/src
7+
168
ADD ./plugin.spec.yaml /plugin.spec.yaml
17-
ADD . /python/src
9+
ADD ./requirements.txt /python/src/requirements.txt
1810

19-
# Install pip dependencies
2011
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2112

22-
# Install plugin
23-
RUN python setup.py build && python setup.py install
13+
ADD . /python/src
14+
15+
RUN python setup.py build && python setup.py install
2416

17+
# User to run plugin code. The two supported users are: root, nobody
18+
USER nobody
2519

2620
ENTRYPOINT ["/usr/local/bin/komand_pagerduty"]

plugins/pagerduty/bin/komand_pagerduty

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python
2-
# GENERATED BY KOMAND SDK - DO NOT EDIT
2+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
33
import os
44
import json
55
from sys import argv
66

77
Name = "PagerDuty"
88
Vendor = "rapid7"
9-
Version = "2.2.0"
9+
Version = "3.0.0"
1010
Description = "Leverage PagerDuty for incident management and response"
1111

1212

@@ -23,7 +23,7 @@ def main():
2323
monkey.patch_all()
2424

2525
import insightconnect_plugin_runtime
26-
from komand_pagerduty import connection, actions, triggers
26+
from komand_pagerduty import connection, actions, triggers, tasks
2727

2828
class ICONPagerduty(insightconnect_plugin_runtime.Plugin):
2929
def __init__(self):
@@ -34,22 +34,22 @@ def main():
3434
description=Description,
3535
connection=connection.Connection()
3636
)
37-
self.add_action(actions.CreateUser())
38-
39-
self.add_action(actions.DeleteUserById())
40-
4137
self.add_action(actions.GetOnCall())
42-
43-
self.add_action(actions.GetUserByEmail())
44-
38+
4539
self.add_action(actions.GetUserById())
46-
40+
41+
self.add_action(actions.GetUserByEmail())
42+
43+
self.add_action(actions.CreateUser())
44+
45+
self.add_action(actions.DeleteUserById())
46+
47+
self.add_action(actions.SendTriggerEvent())
48+
4749
self.add_action(actions.SendAcknowledgeEvent())
48-
50+
4951
self.add_action(actions.SendResolveEvent())
50-
51-
self.add_action(actions.SendTriggerEvent())
52-
52+
5353

5454
"""Run plugin"""
5555
cli = insightconnect_plugin_runtime.CLI(ICONPagerduty())

0 commit comments

Comments
 (0)