Skip to content

Commit

Permalink
[PLGN-362]- Pager Duty - Refactor to use requests rather than pypd (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
rbowden-r7 authored and igorski-r7 committed Nov 2, 2023
1 parent b1ec46d commit 3ec1bdf
Show file tree
Hide file tree
Showing 84 changed files with 4,795 additions and 1,641 deletions.
24 changes: 12 additions & 12 deletions plugins/pagerduty/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"spec": "f20c11c35f0dbd45c4ae3207b10029b4",
"manifest": "322935ff822e9be3217f4e2227e9a00f",
"setup": "4a6275a7299d3b5523ecadf7ab8a163a",
"spec": "6527a68d9fd5097bbb7075b8b279d9b8",
"manifest": "825be40acb77734dcd402f0da001f41b",
"setup": "a4f3b2fabe8b53ce95d26b7439c5d3a8",
"schemas": [
{
"identifier": "create_user/schema.py",
"hash": "d20d7c28c305fdcebb96939510679ae7"
"hash": "c68031209d4fa67ccb59d29e2d9129a0"
},
{
"identifier": "delete_user_by_id/schema.py",
"hash": "55d6f98c36228cc8b294303f54eae49c"
"hash": "796c3831d82077d659ebc859897d3410"
},
{
"identifier": "get_on_call/schema.py",
"hash": "4eb592192c18a8e0a79bd263a2509e29"
"hash": "136d6977b7cf82f1d59f6affa2f3112c"
},
{
"identifier": "get_user_by_email/schema.py",
"hash": "79d23d5f0c61caa02bb2728c940e4503"
"hash": "ca70ed41b688a0648c824a649c5072ff"
},
{
"identifier": "get_user_by_id/schema.py",
"hash": "43da47a5a74bc83c3652b398f29db719"
"hash": "78552441f46e278e02110bb7742d67ac"
},
{
"identifier": "send_acknowledge_event/schema.py",
"hash": "24b59e94be441385f0ce8770647cfa60"
"hash": "29ad62b147f212b81ae75380983190b8"
},
{
"identifier": "send_resolve_event/schema.py",
"hash": "74ea18af0ba61eb8dc40923971eb7d85"
"hash": "139114bf8815c249bac54e8ed9b61ad2"
},
{
"identifier": "send_trigger_event/schema.py",
"hash": "2a003fe3014831f80493498c143d302f"
"hash": "60c41049677bc3b99a28a2b941239d17"
},
{
"identifier": "connection/schema.py",
"hash": "80f4aea21f43406ebe4afe09f912b280"
"hash": "222cae0befdc90d883e5d25ea004a33d"
}
]
}
26 changes: 10 additions & 16 deletions plugins/pagerduty/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
FROM rapid7/insightconnect-python-3-38-slim-plugin:4
# The three supported python parent images are:
# - komand/python-2-plugin
# - komand/python-3-plugin
# - komand/python-pypy3-plugin
#
# Update the tag to a full semver version
FROM rapid7/insightconnect-python-3-38-plugin:5

# Add any custom package dependencies here
# NOTE: Add pip packages to requirements.txt
LABEL organization=rapid7
LABEL sdk=python

# End package dependencies

# Add source code
WORKDIR /python/src

ADD ./plugin.spec.yaml /plugin.spec.yaml
ADD . /python/src
ADD ./requirements.txt /python/src/requirements.txt

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

# Install plugin
RUN python setup.py build && python setup.py install
ADD . /python/src

RUN python setup.py build && python setup.py install

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

ENTRYPOINT ["/usr/local/bin/komand_pagerduty"]
30 changes: 15 additions & 15 deletions plugins/pagerduty/bin/komand_pagerduty
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python
# GENERATED BY KOMAND SDK - DO NOT EDIT
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
import os
import json
from sys import argv

Name = "PagerDuty"
Vendor = "rapid7"
Version = "2.2.0"
Version = "3.0.0"
Description = "Leverage PagerDuty for incident management and response"


Expand All @@ -23,7 +23,7 @@ def main():
monkey.patch_all()

import insightconnect_plugin_runtime
from komand_pagerduty import connection, actions, triggers
from komand_pagerduty import connection, actions, triggers, tasks

class ICONPagerduty(insightconnect_plugin_runtime.Plugin):
def __init__(self):
Expand All @@ -34,22 +34,22 @@ def main():
description=Description,
connection=connection.Connection()
)
self.add_action(actions.CreateUser())

self.add_action(actions.DeleteUserById())

self.add_action(actions.GetOnCall())

self.add_action(actions.GetUserByEmail())


self.add_action(actions.GetUserById())


self.add_action(actions.GetUserByEmail())

self.add_action(actions.CreateUser())

self.add_action(actions.DeleteUserById())

self.add_action(actions.SendTriggerEvent())

self.add_action(actions.SendAcknowledgeEvent())

self.add_action(actions.SendResolveEvent())

self.add_action(actions.SendTriggerEvent())



"""Run plugin"""
cli = insightconnect_plugin_runtime.CLI(ICONPagerduty())
Expand Down
Loading

0 comments on commit 3ec1bdf

Please sign in to comment.