insightconnect-plugin-runtime 5.5.1__tar.gz → 5.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {insightconnect_plugin_runtime-5.5.1/insightconnect_plugin_runtime.egg-info → insightconnect_plugin_runtime-5.5.3}/PKG-INFO +3 -1
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/README.md +2 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect-plugin-swagger.json +10 -1
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/api/endpoints.py +22 -3
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/helper.py +10 -10
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/plugin.py +15 -3
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3/insightconnect_plugin_runtime.egg-info}/PKG-INFO +3 -1
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/setup.py +1 -1
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/MANIFEST.in +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/api/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/api/schemas.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/cli.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/clients/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/clients/aws_client.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/clients/oauth.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/connection.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/data/input_message_schema.json +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/data/output_message_schema.json +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/dispatcher.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/exceptions.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/metrics.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/server.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/step.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/task.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/trigger.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/util.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime/variables.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime.egg-info/SOURCES.txt +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime.egg-info/dependency_links.txt +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime.egg-info/requires.txt +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/insightconnect_plugin_runtime.egg-info/top_level.txt +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/setup.cfg +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/connection.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/task.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/komand_hello_world/util/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/hello_world/setup.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/tests/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/tests/conftest.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/tests/test_cli.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/tests/test_hello_world.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/hello_world/tests/test_server.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/__init__.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_api.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_aws_action.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_custom_encoder.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_endpoints.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_exceptions.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_helpers.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_metrics.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_oauth.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_plugin.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_schema.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_server_cloud_plugins.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_server_spec.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_trigger.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_variables.py +0 -0
- {insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 5.5.
|
|
3
|
+
Version: 5.5.3
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -211,6 +211,8 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
211
211
|
after cloning this repository.
|
|
212
212
|
|
|
213
213
|
## Changelog
|
|
214
|
+
* 5.5.3 - Adding in a new endpoint that can be called to run a task connection test
|
|
215
|
+
* 5.5.2 - Address bug with typing for type `List` in Python 3.8
|
|
214
216
|
* 5.5.1 - Address bug with typing for type `Tuple` in Python 3.8
|
|
215
217
|
* 5.5.0 - Updated helper class to add `make_request`, `response_handler`, `extract_json`, and `request_error_handling` for HTTP requests, and `hash_sha1` and `compare_and_dedupe_hashes` to provide support for hash comparisons | Add `METHOD_NOT_ALLOWED`, `CONFLICT`, `REDIRECT_ERROR`, and `CONNECTION_ERROR` to PluginException presets
|
|
216
218
|
* 5.4.9 - Updated aws_client to clean assume role json object to remove any none or empty string values.
|
|
@@ -182,6 +182,8 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
182
182
|
after cloning this repository.
|
|
183
183
|
|
|
184
184
|
## Changelog
|
|
185
|
+
* 5.5.3 - Adding in a new endpoint that can be called to run a task connection test
|
|
186
|
+
* 5.5.2 - Address bug with typing for type `List` in Python 3.8
|
|
185
187
|
* 5.5.1 - Address bug with typing for type `Tuple` in Python 3.8
|
|
186
188
|
* 5.5.0 - Updated helper class to add `make_request`, `response_handler`, `extract_json`, and `request_error_handling` for HTTP requests, and `hash_sha1` and `compare_and_dedupe_hashes` to provide support for hash comparisons | Add `METHOD_NOT_ALLOWED`, `CONFLICT`, `REDIRECT_ERROR`, and `CONNECTION_ERROR` to PluginException presets
|
|
187
189
|
* 5.4.9 - Updated aws_client to clean assume role json object to remove any none or empty string values.
|
|
@@ -415,10 +415,19 @@
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
},
|
|
418
|
-
"/api/v1/connection/
|
|
418
|
+
"/api/v1/connection/{connection_test_type}": {
|
|
419
419
|
"post": {
|
|
420
420
|
"summary": "Run connection test",
|
|
421
421
|
"description": "Run InsightConnect plugin connection test",
|
|
422
|
+
"parameters": [
|
|
423
|
+
{
|
|
424
|
+
"in": "path",
|
|
425
|
+
"name": "connection_test_type",
|
|
426
|
+
"description": "Type of connection test to be run",
|
|
427
|
+
"type": "string",
|
|
428
|
+
"required": true
|
|
429
|
+
}
|
|
430
|
+
],
|
|
422
431
|
"responses": {
|
|
423
432
|
"200": {
|
|
424
433
|
"description": "Connection test output to be returned",
|
|
@@ -634,14 +634,19 @@ class Endpoints:
|
|
|
634
634
|
schema = conn.schema
|
|
635
635
|
return jsonify(ConnectionDetailsSchema().dump(schema))
|
|
636
636
|
|
|
637
|
-
@v1.route("/connection
|
|
638
|
-
def connection_test():
|
|
637
|
+
@v1.route("/connection/<string:connection_test_type>", methods=["POST"])
|
|
638
|
+
def connection_test(connection_test_type: str):
|
|
639
639
|
"""
|
|
640
640
|
Run connection test endpoint
|
|
641
641
|
---
|
|
642
642
|
post:
|
|
643
643
|
summary: Run connection test
|
|
644
644
|
description: Run InsightConnect plugin connection test
|
|
645
|
+
parameters:
|
|
646
|
+
- in: path
|
|
647
|
+
name: connection_test_type
|
|
648
|
+
description: Type of connection test to be run
|
|
649
|
+
type: string
|
|
645
650
|
responses:
|
|
646
651
|
200:
|
|
647
652
|
description: Connection test output to be returned
|
|
@@ -658,12 +663,26 @@ class Endpoints:
|
|
|
658
663
|
status_code = 200
|
|
659
664
|
output = None
|
|
660
665
|
|
|
666
|
+
supported_tests = ["test", "test_task"]
|
|
667
|
+
if connection_test_type not in supported_tests:
|
|
668
|
+
return make_response(
|
|
669
|
+
jsonify(
|
|
670
|
+
{
|
|
671
|
+
"error": f"The requested endpoint is not available, only {supported_tests} are supported.",
|
|
672
|
+
"code": 404,
|
|
673
|
+
"method": "POST",
|
|
674
|
+
"name": "Not Found"
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
404,
|
|
678
|
+
)
|
|
679
|
+
|
|
661
680
|
input_message = request.get_json(force=True)
|
|
662
681
|
Endpoints.validate_action_trigger_task_empty_input(input_message)
|
|
663
682
|
|
|
664
683
|
try:
|
|
665
684
|
output = self.plugin.handle_step(
|
|
666
|
-
input_message, is_debug=self.debug, is_test=True
|
|
685
|
+
input_message, is_debug=self.debug, is_test=True, connection_test_type=connection_test_type
|
|
667
686
|
)
|
|
668
687
|
if output.get("body", {}).get("output") is None:
|
|
669
688
|
status_code = 204
|
|
@@ -31,11 +31,11 @@ ENCODE_TYPE = "utf-8"
|
|
|
31
31
|
DEFAULTS_HOURS_AGO = 24
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def hash_sha1(log:
|
|
34
|
+
def hash_sha1(log: Dict) -> str:
|
|
35
35
|
"""
|
|
36
36
|
Iterate through a dictionary and hash each value.
|
|
37
37
|
:param log: Dictionary to be hashed.
|
|
38
|
-
:type
|
|
38
|
+
:type Dict:
|
|
39
39
|
:return: Hex digest of hash.
|
|
40
40
|
:rtype: str
|
|
41
41
|
"""
|
|
@@ -80,8 +80,8 @@ def make_request(
|
|
|
80
80
|
allow_redirects: bool = True,
|
|
81
81
|
exception_custom_configs: Dict[int, Exception]={},
|
|
82
82
|
exception_data_location: str = None,
|
|
83
|
-
allowed_status_codes:
|
|
84
|
-
) -> Tuple[requests.Response,
|
|
83
|
+
allowed_status_codes: List[str] = [],
|
|
84
|
+
) -> Tuple[requests.Response, Dict]:
|
|
85
85
|
"""
|
|
86
86
|
Makes a HTTP request while checking for RequestErrors and JSONDecodeErrors
|
|
87
87
|
Returns the request response and the response JSON if required.
|
|
@@ -92,7 +92,7 @@ def make_request(
|
|
|
92
92
|
:param verify: Whether to verify the server's TLS certificate
|
|
93
93
|
:type bool:
|
|
94
94
|
:param cert: Certificate to include with request, str location or key/value pair
|
|
95
|
-
:type Union[str,
|
|
95
|
+
:type Union[str, Dict]:
|
|
96
96
|
:param stream: Whether to immediately download the response content
|
|
97
97
|
:type bool:
|
|
98
98
|
:param allow_redirects: Set to true by default
|
|
@@ -102,10 +102,10 @@ def make_request(
|
|
|
102
102
|
:param exception_data_location: Where the returned data should be retrieved. Can provide ResponseExceptionData values.
|
|
103
103
|
:type str:
|
|
104
104
|
:param allowed_status_codes: Status codes that will not raise an exception.
|
|
105
|
-
:type
|
|
105
|
+
:type List[str]:
|
|
106
106
|
|
|
107
107
|
:return: The request response and the response JSON.
|
|
108
|
-
:rtype: Tuple[Response,
|
|
108
|
+
:rtype: Tuple[Response, Dict]
|
|
109
109
|
"""
|
|
110
110
|
try:
|
|
111
111
|
with requests.Session() as session:
|
|
@@ -139,7 +139,7 @@ def make_request(
|
|
|
139
139
|
return response
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
def extract_json(response: requests.Response) ->
|
|
142
|
+
def extract_json(response: requests.Response) -> Dict:
|
|
143
143
|
"""Extract JSON from a request object while error handling a JSONDecodeError.
|
|
144
144
|
:param response: Response object ot utilize in extract
|
|
145
145
|
:type Response:
|
|
@@ -197,7 +197,7 @@ def response_handler(
|
|
|
197
197
|
response: requests.Response,
|
|
198
198
|
custom_configs: Dict[int, Exception]={},
|
|
199
199
|
data_location: str = None,
|
|
200
|
-
allowed_status_codes:
|
|
200
|
+
allowed_status_codes: List[str] = [],
|
|
201
201
|
) -> None:
|
|
202
202
|
"""
|
|
203
203
|
Check response status codes and return a generic PluginException preset if a HTTPError is raised.
|
|
@@ -210,7 +210,7 @@ def response_handler(
|
|
|
210
210
|
:param data_location: Where the returned data should be retrieved. Can provide ResponseExceptionData values.
|
|
211
211
|
:type str:
|
|
212
212
|
:param allowed_status_codes: Status codes that will not raise an exception.
|
|
213
|
-
:type
|
|
213
|
+
:type List[str]:
|
|
214
214
|
|
|
215
215
|
:return: None.
|
|
216
216
|
:rtype: None
|
|
@@ -362,7 +362,7 @@ class Plugin(object):
|
|
|
362
362
|
if "input" not in body:
|
|
363
363
|
body["input"] = {}
|
|
364
364
|
|
|
365
|
-
def handle_step(self, input_message, is_test=False, is_debug=False):
|
|
365
|
+
def handle_step(self, input_message, is_test=False, is_debug=False, connection_test_type="test"):
|
|
366
366
|
"""
|
|
367
367
|
Executes a single step, given the input message dictionary.
|
|
368
368
|
|
|
@@ -427,6 +427,7 @@ class Plugin(object):
|
|
|
427
427
|
log_stream,
|
|
428
428
|
is_test,
|
|
429
429
|
is_debug,
|
|
430
|
+
connection_test_type=connection_test_type
|
|
430
431
|
)
|
|
431
432
|
elif message_type == "trigger_start":
|
|
432
433
|
out_type = "trigger_event"
|
|
@@ -437,6 +438,7 @@ class Plugin(object):
|
|
|
437
438
|
log_stream,
|
|
438
439
|
is_test,
|
|
439
440
|
is_debug,
|
|
441
|
+
connection_test_type=connection_test_type
|
|
440
442
|
)
|
|
441
443
|
elif message_type == "task_start":
|
|
442
444
|
out_type = "task_event"
|
|
@@ -449,6 +451,7 @@ class Plugin(object):
|
|
|
449
451
|
log_stream,
|
|
450
452
|
is_test,
|
|
451
453
|
is_debug,
|
|
454
|
+
connection_test_type=connection_test_type
|
|
452
455
|
)
|
|
453
456
|
else:
|
|
454
457
|
(
|
|
@@ -464,6 +467,7 @@ class Plugin(object):
|
|
|
464
467
|
log_stream,
|
|
465
468
|
is_test,
|
|
466
469
|
is_debug,
|
|
470
|
+
connection_test_type=connection_test_type
|
|
467
471
|
)
|
|
468
472
|
elif message_type == "connection_test":
|
|
469
473
|
out_type = "connection_test"
|
|
@@ -475,6 +479,7 @@ class Plugin(object):
|
|
|
475
479
|
is_test,
|
|
476
480
|
is_debug,
|
|
477
481
|
is_connection_test=True,
|
|
482
|
+
connection_test_type=connection_test_type
|
|
478
483
|
)
|
|
479
484
|
except (ClientException, ServerException, PluginException, Exception) as e:
|
|
480
485
|
success = False
|
|
@@ -513,6 +518,7 @@ class Plugin(object):
|
|
|
513
518
|
is_test=False,
|
|
514
519
|
is_debug=False,
|
|
515
520
|
is_connection_test=False,
|
|
521
|
+
connection_test_type="test"
|
|
516
522
|
):
|
|
517
523
|
"""
|
|
518
524
|
Starts an action.
|
|
@@ -523,6 +529,7 @@ class Plugin(object):
|
|
|
523
529
|
:param is_test: True if the action's test method should execute
|
|
524
530
|
:param is_debug: True if debug is enabled
|
|
525
531
|
:param is_connection_test: True if connection test is running
|
|
532
|
+
:param connection_test_type: The type of connection test to be run
|
|
526
533
|
:return: An action_event message
|
|
527
534
|
"""
|
|
528
535
|
connection = self.connection_cache.get(message_body["connection"], logger)
|
|
@@ -534,7 +541,9 @@ class Plugin(object):
|
|
|
534
541
|
plugin_version=connection.meta.version,
|
|
535
542
|
)
|
|
536
543
|
)
|
|
537
|
-
if hasattr(connection, "
|
|
544
|
+
if hasattr(connection, "test_task") and connection_test_type == "test_task":
|
|
545
|
+
func = connection.test_task
|
|
546
|
+
elif hasattr(connection, "test"):
|
|
538
547
|
func = connection.test
|
|
539
548
|
else:
|
|
540
549
|
raise NotImplementedError(
|
|
@@ -617,7 +626,10 @@ class Plugin(object):
|
|
|
617
626
|
if is_test:
|
|
618
627
|
# Check if connection test func available. If so - use it (preferred). Else fallback to action/trigger test
|
|
619
628
|
if hasattr(step.connection, "test"):
|
|
620
|
-
|
|
629
|
+
if hasattr(step.connection, "test") and connection_test_type == "test_task":
|
|
630
|
+
func = step.connection.task_test
|
|
631
|
+
else:
|
|
632
|
+
func = step.connection.test
|
|
621
633
|
else:
|
|
622
634
|
func = step.test
|
|
623
635
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 5.5.
|
|
3
|
+
Version: 5.5.3
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -211,6 +211,8 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
211
211
|
after cloning this repository.
|
|
212
212
|
|
|
213
213
|
## Changelog
|
|
214
|
+
* 5.5.3 - Adding in a new endpoint that can be called to run a task connection test
|
|
215
|
+
* 5.5.2 - Address bug with typing for type `List` in Python 3.8
|
|
214
216
|
* 5.5.1 - Address bug with typing for type `Tuple` in Python 3.8
|
|
215
217
|
* 5.5.0 - Updated helper class to add `make_request`, `response_handler`, `extract_json`, and `request_error_handling` for HTTP requests, and `hash_sha1` and `compare_and_dedupe_hashes` to provide support for hash comparisons | Add `METHOD_NOT_ALLOWED`, `CONFLICT`, `REDIRECT_ERROR`, and `CONNECTION_ERROR` to PluginException presets
|
|
216
218
|
* 5.4.9 - Updated aws_client to clean assume role json object to remove any none or empty string values.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/__init__.py
RENAMED
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/plugin/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/test_oauth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-5.5.1 → insightconnect_plugin_runtime-5.5.3}/tests/unit/utils.py
RENAMED
|
File without changes
|