Skip to content

Commit

Permalink
Komand 1.0.4 Release (#1817)
Browse files Browse the repository at this point in the history
* [SOAR-9912] Komand Obsolete (#1812)

* Deprecate

* Update help.md

* [SOAR-9680] Komand Snyk Updates (#1772)

* Update komand -> insight_plugin_runtime

* Update log

* Update exceptions | String formatting | examples

* Black reformat | regen

* Ignore Bandit warning

* Black reformat

* JSON formatting help.md

* Regen

* Update help.md

* [SOAR-9912] Komand Obsolete (#1812)

* Deprecate

* Update help.md
  • Loading branch information
ablakley-r7 authored May 25, 2023
1 parent 360a078 commit 4d2a6cf
Show file tree
Hide file tree
Showing 15 changed files with 298 additions and 146 deletions.
14 changes: 7 additions & 7 deletions plugins/komand/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"spec": "4e786fde1aa6a3442454a650271b5bd0",
"manifest": "4401ae6250c18c56e062c818b1bd86af",
"setup": "61c77e271214ef4b8f913aff446e921e",
"spec": "10457cf131fb240cb5eb30d6d4144c11",
"manifest": "2777097d2933eac28bc56741671f0d99",
"setup": "b25869f305f408eea4c085d1f1d8ae76",
"schemas": [
{
"identifier": "run_asynchronously/schema.py",
"hash": "53aa3ee3fa5f04ee29b31830f945f0f9"
"hash": "3434ef52dbb8a715d4b24dcd5acb53c3"
},
{
"identifier": "run_synchronously/schema.py",
"hash": "956dae3d5681164b0c9a3c7f2a76381a"
"hash": "763c1701fdc0520c1434173e6e286c25"
},
{
"identifier": "connection/schema.py",
"hash": "aa49bcaf442f5e8a84cce13175607d52"
"hash": "820a19f7b96b39d81d0ca8cfa82c66ae"
},
{
"identifier": "job/schema.py",
"hash": "5c06b56479720ad202fe815b3471de71"
"hash": "443c2fd80fe621788a385924efcad058"
}
]
}
20 changes: 12 additions & 8 deletions plugins/komand/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
FROM komand/python-3-plugin:2
# 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
LABEL organization=komand
LABEL sdk=python
LABEL type=plugin

ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV SSL_CERT_DIR /etc/ssl/certs
ENV REQUESTS_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt

# Add any custom package dependencies here
# NOTE: Add pip packages to requirements.txt

# End package dependencies

# Add source code
WORKDIR /python/src
ADD ./plugin.spec.yaml /plugin.spec.yaml
ADD . /python/src

WORKDIR /python/src

# 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

USER nobody

ENTRYPOINT ["/usr/local/bin/komand_komand"]
46 changes: 30 additions & 16 deletions plugins/komand/bin/komand_komand
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
#!/usr/bin/env python
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
from komand_komand import connection, actions, triggers
import os
import json
from sys import argv

Name = "Komand"
Vendor = "rapid7"
Version = "1.0.4"
Description = "Komand Meta-Actions"

Name = 'Komand'
Vendor = 'rapid7'
Version = '1.0.3'
Description = 'Komand Meta-Actions'


class ICONKomand(komand.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
def main():
if 'http' in argv:
if os.environ.get("GUNICORN_CONFIG_FILE"):
with open(os.environ.get("GUNICORN_CONFIG_FILE")) as gf:
gunicorn_cfg = json.load(gf)
if gunicorn_cfg.get("worker_class", "sync") == "gevent":
from gevent import monkey
monkey.patch_all()
elif 'gevent' in argv:
from gevent import monkey
monkey.patch_all()

import insightconnect_plugin_runtime
from komand_komand import connection, actions, triggers

class ICONKomand(insightconnect_plugin_runtime.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
name=Name,
vendor=Vendor,
version=Version,
description=Description,
connection=connection.Connection()
)
self.add_trigger(triggers.Job())
)
self.add_trigger(triggers.Job())

self.add_action(actions.RunAsynchronously())
self.add_action(actions.RunAsynchronously())

self.add_action(actions.RunSynchronously())
self.add_action(actions.RunSynchronously())


def main():
"""Run plugin"""
cli = komand.CLI(ICONKomand())
cli = insightconnect_plugin_runtime.CLI(ICONKomand())
cli.run()


Expand Down
184 changes: 136 additions & 48 deletions plugins/komand/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,32 @@ The [Komand](komand.com) plugin provides backwards compatibility to run workflow
* Username and Password
* Komand Server

# Supported Product Versions

* 2023-05-15

# Documentation

## Setup

The connection configuration accepts the following parameters:

|Name|Type|Default|Required|Description|Enum|
|----|----|-------|--------|-----------|----|
|url|string|None|True|URL to Komand server, e.g. https://komand.company.com|None|
|credentials|credential_username_password|None|True|Username and password for user|None|
|Name|Type|Default|Required|Description|Enum|Example|
|----|----|-------|--------|-----------|----|-------|
|url|string|None|True|URL to Komand server|None|https://komand.company.com|
|credentials|credential_username_password|None|True|Username and password for user|None|{ 'username': 'user1', 'password': 'mypassword' }|

Example input:

```
{
"credentials": {
"username": "user1",
"password": "mypassword"
},
"url": "https://komand.company.com"
}
```

## Technical Details

Expand All @@ -33,47 +49,95 @@ This action is used to run a workflow without waiting for results.

##### Input

|Name|Type|Default|Required|Description|Enum|
|----|----|-------|--------|-----------|----|
|workflow_uid|string|None|False|Workflow UID to run. Either this or name should be provided.|None|
|input|object|None|False|Input object to supply to the workflow job|None|
|workflow_name|string|None|False|Workflow name to run. Either this or UID should be provided.|None|
|Name|Type|Default|Required|Description|Enum|Example|
|----|----|-------|--------|-----------|----|-------|
|input|object|None|False|Input object to supply to the workflow job|None|{}|
|workflow_name|string|None|False|Workflow name to run. Either this or UID should be provided|None|example-name|
|workflow_uid|string|None|False|Workflow UID to run. Either this or name should be provided|None|b595ccea-f324-11ed-a05b-0242ac120003|

Example input:

```
{
"input": "{}",
"workflow_name": "example-name",
"workflow_uid": "b595ccea-f324-11ed-a05b-0242ac120003"
}
```

##### Output

|Name|Type|Required|Description|
|----|----|--------|-----------|
|url|string|False|Job URL|
|job_id|string|False|Job ID|
|Name|Type|Required|Description|Example|
|----|----|--------|-----------|-------|
|url|string|False|Job URL|www.example.com|
|job_id|string|False|Job ID|b595ccea-f324-11ed-a05b-0242ac120003|

Example output:

```
{
"url": "www.example.com",
"job_id": "b595ccea-f324-11ed-a05b-0242ac120003"
}
```

#### Run Synchronously

This action is used to run a workflow and wait for results.

##### Input

|Name|Type|Default|Required|Description|Enum|
|----|----|-------|--------|-----------|----|
|workflow_uid|string|None|False|Workflow UID to run. Either this or name should be provided|None|
|input|object|None|False|Input object to supply to the workflow job|None|
|workflow_name|string|None|False|Workflow name to run. Either this or UID should be provided|None|
|timeout|number|150|True|Timeout for executed workflow to finish, in seconds. Use 0 for no timeout|None|
|completion_checks|number|10|False|How many times the executed workflow should be checked for completion during the timeout period. Higher numbers should result in quicker job turnover. Leave blank if timeout is set to 0|None|
|Name|Type|Default|Required|Description|Enum|Example|
|----|----|-------|--------|-----------|----|-------|
|completion_checks|number|10|False|How many times the executed workflow should be checked for completion during the timeout period. Higher numbers should result in quicker job turnover. Leave blank if timeout is set to 0|None|10|
|input|object|None|False|Input object to supply to the workflow job|None|{}|
|timeout|number|150|True|Timeout for executed workflow to finish, in seconds. Use 0 for no timeout|None|150|
|workflow_name|string|None|False|Workflow name to run. Either this or UID should be provided|None|example-name|
|workflow_uid|string|None|False|Workflow UID to run. Either this or name should be provided|None|b595ccea-f324-11ed-a05b-0242ac120003|

Example input:

```
{
"completion_checks": 10,
"input": "{}",
"timeout": 150,
"workflow_name": "example-name",
"workflow_uid": "b595ccea-f324-11ed-a05b-0242ac120003"
}
```

##### Output

|Name|Type|Required|Description|
|----|----|--------|-----------|
|status|string|False|Job Status|
|ended_at|string|False|None|
|job_id|string|False|Job ID|
|workflow_uid|string|False|Workflow UID|
|created_at|string|False|None|
|updated_at|string|False|None|
|url|string|False|Job URL|
|steps|[]object|False|Step outputs|
|group_id|string|False|Job Group ID|
|name|string|False|None|
|Name|Type|Required|Description|Example|
|----|----|--------|-----------|-------|
|status|string|False|Job Status|failed|
|ended_at|string|False|None|Jan 01, 2000 0:00 AM|
|job_id|string|False|Job ID|b595ccea-f324-11ed-a05b-0242ac120003|
|workflow_uid|string|False|Workflow UID|b595ccea-f324-11ed-a05b-0242ac120003|
|created_at|string|False|Created at|Jan 01, 2000 0:00 AM|
|updated_at|string|False|Updated at|Jan 01, 2000 0:00 AM|', '|ended_at|string|False|Ended at|Jan 01, 2000 0:00 AM|
|url|string|False|Job URL|www.example.com|
|steps|[]object|False|Step outputs|[{}]|
|group_id|string|False|Job Group ID|b595ccea-f324-11ed-a05b-0242ac120003|
|name|string|False|Name|example-name|

Example output:

```
{
"status": "failed",
"ended_at": "Jan 01, 2000 0:00 AM",
"job_id": "b595ccea-f324-11ed-a05b-0242ac120003",
"workflow_uid": "b595ccea-f324-11ed-a05b-0242ac120003",
"created_at": "Jan 01, 2000 0:00 AM",
"updated_at": "Jan 01, 2000 0:00 AM",
"url": "www.example.com",
"steps": [{}],
"group_id": "b595ccea-f324-11ed-a05b-0242ac120003",
"name": "example-name"
}
```

### Triggers

Expand All @@ -83,23 +147,47 @@ This trigger is used to monitor for new jobs.

##### Input

|Name|Type|Default|Required|Description|Enum|
|----|----|-------|--------|-----------|----|
|status|string|None|True|Status to trigger on|['failed', 'queued', 'succeeded', 'retried']|
|Name|Type|Default|Required|Description|Enum|Example|
|----|----|-------|--------|-----------|----|-------|
|status|string|None|True|Status to trigger on|['failed', 'queued', 'succeeded', 'retried']|failed|

Example input:

```
{
"status": "failed"
}
```

##### Output

|Name|Type|Required|Description|
|----|----|--------|-----------|
|status|string|False|Job Status|
|ended_at|string|False|None|
|job_id|string|False|Job ID|
|workflow_uid|string|False|Workflow UID|
|created_at|string|False|None|
|updated_at|string|False|None|
|url|string|False|Job URL|
|group_id|string|False|Job Group ID|
|name|string|False|None|
|Name|Type|Required|Description|Example|
|----|----|--------|-----------|-------|
|status|string|False|Job status|succeeded|
|ended_at|string|False|Ended at|Jan 01, 2000 0:00 AM|
|job_id|string|False|Job ID|b595ccea-f324-11ed-a05b-0242ac120003|
|workflow_uid|string|False|Workflow UID|b595ccea-f324-11ed-a05b-0242ac120003|
|created_at|string|False|Created at|Jan 01, 2000 0:00 AM|
|updated_at|string|False|Updated at|Jan 01, 2000 0:00 AM|
|url|string|False|Job URL|www.example.com|
|group_id|string|False|Job group ID|b595ccea-f324-11ed-a05b-0242ac120003|
|name|string|False|Name|example-name|

Example output:

```
{
"status": "failed",
"ended_at": "Jan 01, 2000 0:00 AM",
"job_id": "b595ccea-f324-11ed-a05b-0242ac120003",
"workflow_uid": "b595ccea-f324-11ed-a05b-0242ac120003",
"created_at": "Jan 01, 2000 0:00 AM",
"updated_at": "Jan 01, 2000 0:00 AM",
"url": "www.example.com",
"group_id": "b595ccea-f324-11ed-a05b-0242ac120003",
"name": "example-name"
}
```

### Custom Output Types

Expand All @@ -111,6 +199,7 @@ _This plugin does not contain any troubleshooting information._

# Version History

* 1.0.4 - Deprecate Komand plugin as it is no longer supported
* 1.0.3 - New spec and help.md format for the Extension Library
* 1.0.2 - Add `utilities` plugin tag for Marketplace searchability
* 1.0.1 - Fix issue where Lookup Workflow Name can crash due to excessive data
Expand All @@ -124,7 +213,6 @@ _This plugin does not contain any troubleshooting information._

# Links

## References

* [Komand](https://www.komand.com/)

## References
Loading

0 comments on commit 4d2a6cf

Please sign in to comment.