insight-plugin 1.2.0__tar.gz → 1.4.0__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.
Files changed (137) hide show
  1. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/PKG-INFO +18 -1
  2. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/README.md +17 -0
  3. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/__init__.py +1 -1
  4. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/__main__.py +1 -10
  5. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/__pycache__/__init__.cpython-39.pyc +0 -0
  6. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/plugin_spec_util.py +2 -1
  7. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/schema_util.py +6 -0
  8. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/controller.py +1 -10
  9. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/constants.py +2 -0
  10. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/help_util.py +2 -0
  11. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/actions/action/action.py.jinja +3 -2
  12. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/triggers/trigger/trigger.py.jinja +3 -2
  13. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/PKG-INFO +18 -1
  14. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/SOURCES.txt +0 -5
  15. insight_plugin-1.2.0/insight_plugin/features/interactive/controller.py +0 -247
  16. insight_plugin-1.2.0/insight_plugin/features/interactive/util/util.py +0 -227
  17. insight_plugin-1.2.0/tests/resources/export_test_base64/__init__.py +0 -0
  18. insight_plugin-1.2.0/tests/resources/export_test_base64/unit_test/__init__.py +0 -0
  19. insight_plugin-1.2.0/tests/test_interactive.py +0 -91
  20. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/LICENSE +0 -0
  21. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/constants.py +0 -0
  22. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/__init__.py +0 -0
  23. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/analysis/__init__.py +0 -0
  24. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/analysis/controller.py +0 -0
  25. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/__init__.py +0 -0
  26. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/builder.py +0 -0
  27. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/checksum_util.py +0 -0
  28. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/command_line_util.py +0 -0
  29. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/common_feature.py +0 -0
  30. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/docker_util.py +0 -0
  31. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/dockerspec.py +0 -0
  32. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/exceptions.py +0 -0
  33. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/logging_util.py +0 -0
  34. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/temp_file_util.py +0 -0
  35. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/common/template_util.py +0 -0
  36. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/__init__.py +0 -0
  37. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/__init__.py +0 -0
  38. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/components.py +0 -0
  39. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/connection_help.py +0 -0
  40. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/help/input_output_helpers.py +0 -0
  41. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/json_generation_util.py +0 -0
  42. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/plugin_to_helpmd.py +0 -0
  43. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/create/util.py +0 -0
  44. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/export/__init__.py +0 -0
  45. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/export/controller.py +0 -0
  46. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/export/util/__init__.py +0 -0
  47. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/export/util/util.py +0 -0
  48. {insight_plugin-1.2.0/insight_plugin/features/interactive → insight_plugin-1.4.0/insight_plugin/features/linter}/__init__.py +0 -0
  49. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/linter/controller.py +0 -0
  50. {insight_plugin-1.2.0/insight_plugin/features/interactive/util → insight_plugin-1.4.0/insight_plugin/features/refresh}/__init__.py +0 -0
  51. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/refresh/controller.py +0 -0
  52. {insight_plugin-1.2.0/insight_plugin/features/linter → insight_plugin-1.4.0/insight_plugin/features/run}/__init__.py +0 -0
  53. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/run/bash_controller.py +0 -0
  54. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/run/run_controller.py +0 -0
  55. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/run/server_controller.py +0 -0
  56. {insight_plugin-1.2.0/insight_plugin/features/refresh → insight_plugin-1.4.0/insight_plugin/features/samples}/__init__.py +0 -0
  57. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/samples/controller.py +0 -0
  58. {insight_plugin-1.2.0/insight_plugin/features/run → insight_plugin-1.4.0/insight_plugin/features/samples/util}/__init__.py +0 -0
  59. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/samples/util/constants.py +0 -0
  60. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/samples/util/util.py +0 -0
  61. {insight_plugin-1.2.0/insight_plugin/features/samples → insight_plugin-1.4.0/insight_plugin/features/validate}/__init__.py +0 -0
  62. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/validate/controller.py +0 -0
  63. {insight_plugin-1.2.0/insight_plugin/features/samples/util → insight_plugin-1.4.0/insight_plugin/features/version}/__init__.py +0 -0
  64. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/version/controller.py +0 -0
  65. {insight_plugin-1.2.0/insight_plugin/features/validate → insight_plugin-1.4.0/insight_plugin/features/version/util}/__init__.py +0 -0
  66. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/version/util/helpmd_util.py +0 -0
  67. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/version/util/input_util.py +0 -0
  68. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/version/util/version_util.py +0 -0
  69. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/version/util/yaml_util.py +0 -0
  70. {insight_plugin-1.2.0/insight_plugin/features/version → insight_plugin-1.4.0/insight_plugin/features/view}/__init__.py +0 -0
  71. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/features/view/controller.py +0 -0
  72. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/.dockerignore.jinja +0 -0
  73. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/Dockerfile.jinja +0 -0
  74. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/Makefile.jinja +0 -0
  75. {insight_plugin-1.2.0/insight_plugin/features/version/util → insight_plugin-1.4.0/insight_plugin/templates}/__init__.py +0 -0
  76. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/assessment/assessment.jinja +0 -0
  77. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/bin/plugin.jinja +0 -0
  78. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/__init__.py.jinja +0 -0
  79. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/actions/__init__.py.jinja +0 -0
  80. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/actions/action/__init__.py.jinja +0 -0
  81. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/actions/action/schema.py.jinja +0 -0
  82. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/connection/__init__.py.jinja +0 -0
  83. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/connection/connection.py.jinja +0 -0
  84. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/connection/schema.py.jinja +0 -0
  85. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/tasks/__init__.py.jinja +0 -0
  86. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/tasks/task/__init__.py.jinja +0 -0
  87. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/tasks/task/schema.py.jinja +0 -0
  88. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/tasks/task/task.py.jinja +0 -0
  89. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/triggers/__init__.py.jinja +0 -0
  90. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/triggers/trigger/__init__.py.jinja +0 -0
  91. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/triggers/trigger/schema.py.jinja +0 -0
  92. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/plugin/util/__init__.py.jinja +0 -0
  93. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/requirements.txt.jinja +0 -0
  94. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/setup.py.jinja +0 -0
  95. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/unit_test/__init__.py.jinja +0 -0
  96. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin/templates/unit_test/test_action.py.jinja +0 -0
  97. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/dependency_links.txt +0 -0
  98. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/entry_points.txt +0 -0
  99. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/requires.txt +0 -0
  100. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/insight_plugin.egg-info/top_level.txt +0 -0
  101. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/pyproject.toml +0 -0
  102. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/setup.cfg +0 -0
  103. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/setup.py +0 -0
  104. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/__init__.py +0 -0
  105. {insight_plugin-1.2.0/insight_plugin/features/view → insight_plugin-1.4.0/tests/resources}/__init__.py +0 -0
  106. {insight_plugin-1.2.0/insight_plugin/templates → insight_plugin-1.4.0/tests/resources/export_test_base64}/__init__.py +0 -0
  107. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/__init__.py +0 -0
  108. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/__init__.py +0 -0
  109. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/decode/__init__.py +0 -0
  110. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/decode/action.py +0 -0
  111. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/decode/schema.py +0 -0
  112. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/encode/__init__.py +0 -0
  113. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/encode/action.py +0 -0
  114. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/actions/encode/schema.py +0 -0
  115. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/connection/__init__.py +0 -0
  116. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/connection/connection.py +0 -0
  117. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/connection/schema.py +0 -0
  118. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/triggers/__init__.py +0 -0
  119. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/komand_base64/util/__init__.py +0 -0
  120. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/setup.py +0 -0
  121. {insight_plugin-1.2.0/tests/resources → insight_plugin-1.4.0/tests/resources/export_test_base64/unit_test}/__init__.py +0 -0
  122. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/resources/export_test_base64/unit_test/test_encode.py +0 -0
  123. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test.py +0 -0
  124. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_checksum.py +0 -0
  125. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_create.py +0 -0
  126. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_export.py +0 -0
  127. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_gen_samples.py +0 -0
  128. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_help_creation.py +0 -0
  129. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_json_generate.py +0 -0
  130. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_refresh.py +0 -0
  131. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_run.py +0 -0
  132. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_schema.py +0 -0
  133. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_semver.py +0 -0
  134. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_spec_order.py +0 -0
  135. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_temp_file_util.py +0 -0
  136. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/test_validate.py +0 -0
  137. {insight_plugin-1.2.0 → insight_plugin-1.4.0}/tests/util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: insight_plugin
3
- Version: 1.2.0
3
+ Version: 1.4.0
4
4
  Summary: Plugin tooling for the Rapid7 Insight platform
5
5
  Home-page: https://github.com/rapid7/insight-plugin
6
6
  Author: Rapid7 Integrations Alliance
@@ -20,6 +20,23 @@ License-File: LICENSE
20
20
 
21
21
  ## Commands
22
22
 
23
+ ### Analysis
24
+ Run Static Code Analysis on the plugin.
25
+
26
+ This command will run the static code analysis check on the plugin.
27
+
28
+ ### Linter
29
+ Run the linter check on the plugin.
30
+
31
+ This command will run the `black` linter on the plugin and return any
32
+ formatting issues with the plugin.
33
+
34
+ ### Checks
35
+ Run analysis, linter and validate on the plugin.
36
+
37
+ This will allow you to recreate, locally, all the github checks that get run
38
+ on plugins.
39
+
23
40
  ### Create
24
41
  Create a new plugin.
25
42
 
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## Commands
4
4
 
5
+ ### Analysis
6
+ Run Static Code Analysis on the plugin.
7
+
8
+ This command will run the static code analysis check on the plugin.
9
+
10
+ ### Linter
11
+ Run the linter check on the plugin.
12
+
13
+ This command will run the `black` linter on the plugin and return any
14
+ formatting issues with the plugin.
15
+
16
+ ### Checks
17
+ Run analysis, linter and validate on the plugin.
18
+
19
+ This will allow you to recreate, locally, all the github checks that get run
20
+ on plugins.
21
+
5
22
  ### Create
6
23
  Create a new plugin.
7
24
 
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import sys
3
3
 
4
- VERSION = "1.2.0"
4
+ VERSION = "1.4.0"
5
5
  ROOT_DIR = os.path.dirname(
6
6
  os.path.abspath(__file__)
7
7
  ) # Python module root, ex. insight-plugin/insight_plugin/
@@ -16,7 +16,6 @@ from insight_plugin.features.run.run_controller import RunController
16
16
  from insight_plugin.features.validate.controller import ValidateController
17
17
  from insight_plugin.features.run.server_controller import RunServerController
18
18
  from insight_plugin.features.run.bash_controller import RunShellController
19
- from insight_plugin.features.interactive.controller import InteractiveController
20
19
  from insight_plugin.features.common.exceptions import InsightException
21
20
  from insight_plugin.features.version.controller import VersionController
22
21
  from insight_plugin.features.view.controller import ViewController
@@ -99,7 +98,7 @@ def main():
99
98
  except InsightException as error:
100
99
  logging.exception(error)
101
100
  except AttributeError:
102
- interactive()
101
+ print("try 'insight-plugin --help' for more information")
103
102
 
104
103
 
105
104
  def create_argparse(subparsers, parsers_list: List) -> None:
@@ -175,14 +174,6 @@ def export(args: Namespace) -> None:
175
174
  controller.export()
176
175
 
177
176
 
178
- def interactive() -> None:
179
- """
180
- Start a general interactive session with the user
181
- :return: None
182
- """
183
- InteractiveController.prompt_menu()
184
-
185
-
186
177
  def refresh_argparse(subparsers, parsers_list: List) -> None:
187
178
  """
188
179
  Handle the arg-parsing for the refresh subcommand
@@ -15,6 +15,8 @@ class PluginSpecConstants:
15
15
  DESCRIPTION: Final = "description"
16
16
  ENUM: Final = "enum"
17
17
  EXAMPLE: Final = "example"
18
+ PLACEHOLDER: Final = "placeholder"
19
+ TOOLTIP: Final = "tooltip"
18
20
  FILENAME: Final = "plugin.spec.yaml"
19
21
  FILEPATH: Final = "filepath"
20
22
  HELP: Final = "help"
@@ -62,7 +64,6 @@ class PluginComponent(Enum):
62
64
  class PluginSpecUtilModes(Enum):
63
65
  # Class that would later support alternate ways of getting the spec file
64
66
  SPECFILE = f"{PluginSpecConstants.FILEPATH} mode"
65
- INTERACTIVE = "interactive"
66
67
  GUI = "gui"
67
68
 
68
69
 
@@ -440,6 +440,12 @@ class SchemaUtil:
440
440
  )
441
441
  # Set the current parameter default if one exists.
442
442
  SchemaUtil.try_add(PluginSpecConstants.DEFAULT, items, parent_object[key])
443
+ # Set placeholder
444
+ SchemaUtil.try_add(
445
+ PluginSpecConstants.PLACEHOLDER, items, parent_object[key]
446
+ )
447
+ # Set tooltip
448
+ SchemaUtil.try_add(PluginSpecConstants.TOOLTIP, items, parent_object[key])
443
449
  # If the current parameter is an array (it has items contents), set the items object dict.
444
450
  if array_items[SchemaConstants.ITEMS]:
445
451
  SchemaUtil.try_add(
@@ -38,14 +38,6 @@ class CreateController(CommonFeature):
38
38
  kwargs.get("target_dir"),
39
39
  )
40
40
 
41
- def interactive_prompt_spec(self) -> PluginSpecTypes.Spec:
42
- # TODO: Implement interactive create
43
- self.logger.warning(
44
- "Creating a plugin spec interactively is not yet supported. "
45
- "Please create a plugin.spec.yaml"
46
- )
47
- return {"": ""}
48
-
49
41
  def spec_to_file(self, spec: PluginSpecTypes.Spec, plugin_dir: str):
50
42
  with open(
51
43
  os.path.join(plugin_dir, "plugin.spec.yaml"), "w", encoding=FILE_ENCODING
@@ -75,8 +67,7 @@ class CreateController(CommonFeature):
75
67
  spec = PluginSpecUtil.get_spec_file(self._spec_path)
76
68
  else:
77
69
  # TODO
78
- # Interactively prompt the user for plugin spec configuration values
79
- spec = self.interactive_prompt_spec()
70
+ print("No spec file provided")
80
71
 
81
72
  # The target directory will CONTAIN the top-level directory containing all plugin content.
82
73
  # The target directory IS NOT the top-level plugin directory itself.
@@ -37,6 +37,8 @@ class TableHeaders:
37
37
  "Description",
38
38
  "Enum",
39
39
  "Example",
40
+ "Placeholder",
41
+ "Tooltip",
40
42
  ]
41
43
  OUTPUT_HEADERS = [
42
44
  "Name",
@@ -49,6 +49,8 @@ class HelpUtil:
49
49
  item.get(PluginSpecConstants.DESCRIPTION, "None"),
50
50
  item.get(PluginSpecConstants.ENUM, "None"),
51
51
  item.get(PluginSpecConstants.EXAMPLE, "None"),
52
+ item.get(PluginSpecConstants.PLACEHOLDER, "None"),
53
+ item.get(PluginSpecConstants.TOOLTIP, "None"),
52
54
  ]
53
55
  elif table_type == TableHeaders.OUTPUT_HEADERS:
54
56
  next_row = [
@@ -20,6 +20,7 @@ class {{ upper_camel_case(action) }}({{ base_module }}.Action):
20
20
  # END INPUT BINDING - DO NOT REMOVE
21
21
 
22
22
  return {
23
- {% for parameter in outputs.keys()|sort -%}Output.{{ parameter.upper().replace("-", "") }}: None,
24
- {% endfor %}
23
+ {%- for parameter in outputs.keys()|sort %}
24
+ Output.{{ parameter.upper().replace("-", "") }}: None,
25
+ {%- endfor %}
25
26
  }
@@ -23,7 +23,8 @@ class {{ upper_camel_case(trigger) }}({{ base_module }}.Trigger):
23
23
  while True:
24
24
  # TODO: Implement trigger functionality
25
25
  self.send({
26
- {% for parameter in outputs.keys()|sort -%}Output.{{ parameter.upper().replace("-", "") }}: None,
27
- {% endfor %}
26
+ {%- for parameter in outputs.keys()|sort %}
27
+ Output.{{ parameter.upper().replace("-", "") }}: None,
28
+ {%- endfor %}
28
29
  })
29
30
  time.sleep(5)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: insight-plugin
3
- Version: 1.2.0
3
+ Version: 1.4.0
4
4
  Summary: Plugin tooling for the Rapid7 Insight platform
5
5
  Home-page: https://github.com/rapid7/insight-plugin
6
6
  Author: Rapid7 Integrations Alliance
@@ -20,6 +20,23 @@ License-File: LICENSE
20
20
 
21
21
  ## Commands
22
22
 
23
+ ### Analysis
24
+ Run Static Code Analysis on the plugin.
25
+
26
+ This command will run the static code analysis check on the plugin.
27
+
28
+ ### Linter
29
+ Run the linter check on the plugin.
30
+
31
+ This command will run the `black` linter on the plugin and return any
32
+ formatting issues with the plugin.
33
+
34
+ ### Checks
35
+ Run analysis, linter and validate on the plugin.
36
+
37
+ This will allow you to recreate, locally, all the github checks that get run
38
+ on plugins.
39
+
23
40
  ### Create
24
41
  Create a new plugin.
25
42
 
@@ -43,10 +43,6 @@ insight_plugin/features/export/__init__.py
43
43
  insight_plugin/features/export/controller.py
44
44
  insight_plugin/features/export/util/__init__.py
45
45
  insight_plugin/features/export/util/util.py
46
- insight_plugin/features/interactive/__init__.py
47
- insight_plugin/features/interactive/controller.py
48
- insight_plugin/features/interactive/util/__init__.py
49
- insight_plugin/features/interactive/util/util.py
50
46
  insight_plugin/features/linter/__init__.py
51
47
  insight_plugin/features/linter/controller.py
52
48
  insight_plugin/features/refresh/__init__.py
@@ -105,7 +101,6 @@ tests/test_create.py
105
101
  tests/test_export.py
106
102
  tests/test_gen_samples.py
107
103
  tests/test_help_creation.py
108
- tests/test_interactive.py
109
104
  tests/test_json_generate.py
110
105
  tests/test_refresh.py
111
106
  tests/test_run.py
@@ -1,247 +0,0 @@
1
- from insight_plugin import VERSION
2
- import sys
3
- from insight_plugin.features.create.controller import CreateController
4
- from insight_plugin.features.validate.controller import ValidateController
5
- from insight_plugin.features.refresh.controller import RefreshController
6
- from insight_plugin.features.run.run_controller import RunController
7
- from insight_plugin.features.export.controller import ExportController
8
- from typing import Tuple, Optional, Union
9
- from insight_plugin.constants import SubcommandDescriptions
10
- from insight_plugin.features.interactive.util.util import (
11
- retrieve_bool_input,
12
- retrieve_path_input,
13
- retrieve_jq_input,
14
- create_and_refresh_cli_controller,
15
- export_cli_controller,
16
- run_cli_controller,
17
- validate_cli_controller,
18
- )
19
-
20
-
21
- class _Option(object):
22
- def __init__(self, title: str, description: str):
23
- self.title = title
24
- self.description = description
25
-
26
-
27
- # TODO: Make this dynamic instead of hardcoded
28
- _OPTIONS = [
29
- # 1
30
- _Option(title="Create", description=SubcommandDescriptions.CREATE_DESCRIPTION),
31
- # 2
32
- _Option(title="Refresh", description=SubcommandDescriptions.REFRESH_DESCRIPTION),
33
- # 3
34
- _Option(title="Run", description=SubcommandDescriptions.RUN_DESCRIPTION),
35
- # 4
36
- _Option(title="Validate", description=SubcommandDescriptions.VALIDATE_DESCRIPTION),
37
- # 5
38
- _Option(title="Export", description=SubcommandDescriptions.EXPORT_DESCRIPTION),
39
- ]
40
-
41
-
42
- class InteractiveController(object):
43
- @staticmethod
44
- def prompt_menu():
45
- """
46
- This function handles the main functionality of printing
47
- the menu and retrieving the user input
48
- :return:
49
- """
50
- print(InteractiveController._get_interactive_menu_text())
51
-
52
- selection = None
53
- try:
54
- selection = int(input())
55
- except ValueError:
56
- sys.exit(1)
57
-
58
- InteractiveController._route_selection(selection=selection)
59
-
60
- @staticmethod
61
- def _route_selection(selection: int):
62
- """
63
- Handles the routing based on the user input
64
- :param selection: The users selection.
65
- :return:
66
- """
67
- if selection == 1:
68
- (
69
- path_to_spec,
70
- target_dir,
71
- verbose,
72
- ) = InteractiveController._get_create_refresh_controller_menu()
73
-
74
- controller = create_and_refresh_cli_controller(
75
- controller_name=CreateController,
76
- path_to_spec=path_to_spec,
77
- verbose=verbose,
78
- target_dir=target_dir,
79
- )
80
- controller.create()
81
-
82
- if selection == 2:
83
- (
84
- path_to_spec,
85
- target_dir,
86
- verbose,
87
- ) = InteractiveController._get_create_refresh_controller_menu()
88
-
89
- controller = create_and_refresh_cli_controller(
90
- controller_name=RefreshController,
91
- path_to_spec=path_to_spec,
92
- verbose=verbose,
93
- target_dir=target_dir,
94
- )
95
-
96
- controller.refresh()
97
-
98
- if selection == 3:
99
- (
100
- json_target,
101
- target_dir,
102
- verbose,
103
- assessment,
104
- is_test,
105
- jq,
106
- ) = InteractiveController._get_run_controller_menu()
107
-
108
- controller = run_cli_controller(
109
- controller_name=RunController,
110
- verbose=verbose,
111
- target_dir=target_dir,
112
- assessment=assessment,
113
- test=is_test,
114
- jq=jq,
115
- json_files=json_target,
116
- )
117
-
118
- controller.run()
119
-
120
- if selection == 4:
121
- path_to_spec = InteractiveController._get_validate_controller_menu()
122
-
123
- controller = validate_cli_controller(
124
- controller_name=ValidateController, path_to_spec=path_to_spec
125
- )
126
-
127
- controller.validate()
128
-
129
- if selection == 5:
130
- (
131
- no_pull,
132
- verbose,
133
- target_dir,
134
- ) = InteractiveController._get_export_controller_menu()
135
-
136
- controller = export_cli_controller(
137
- controller_name=ExportController,
138
- target_dir=target_dir,
139
- no_pull=no_pull,
140
- verbose=verbose,
141
- )
142
-
143
- controller.export()
144
-
145
- else:
146
- sys.exit(1)
147
-
148
- @staticmethod
149
- def _get_interactive_menu_text() -> str:
150
- """
151
- This method generates the initial interactive menu text.
152
- It produces a welcome statement and iterates through all
153
- potential options for the user.
154
- :return: The welcome menu
155
- :rtype: str
156
- """
157
- menu = f"Welcome to insight-plugin {VERSION}!\n\nWhat would you like to do?\n"
158
-
159
- for num, option in enumerate(_OPTIONS, start=1):
160
- menu += f"{num}. [{option.title}] - {option.description}\n"
161
-
162
- menu += "\nChoose a menu item from above or press any other key to exit: "
163
-
164
- return menu
165
-
166
- @staticmethod
167
- def _get_create_refresh_controller_menu() -> Tuple[str, Union[str, None], bool]:
168
- """
169
- A function to prompt the user to provide a path to the plugin spec
170
- file, target directory & verbose for the create & refresh subcommand.
171
- :return: Tuple containing path to spec file, target directory & verbose boolean.
172
- """
173
-
174
- # Handle path to spec file input
175
- path_to_spec = retrieve_path_input("plugin.spec.yaml")
176
-
177
- # Handle target directory input
178
- target_dir = retrieve_path_input("target directory")
179
-
180
- # Handle verbose input
181
- verbose = retrieve_bool_input("verbose")
182
-
183
- return path_to_spec, target_dir, verbose
184
-
185
- @staticmethod
186
- def _get_validate_controller_menu() -> str:
187
- """
188
- Method to handle inputs for the validate command.
189
- :return: Path to the plugin.spec.yaml file
190
- """
191
-
192
- # Handle path to spec file input
193
- path_to_spec = retrieve_path_input("plugin.spec.yaml")
194
-
195
- return path_to_spec
196
-
197
- @staticmethod
198
- def _get_run_controller_menu() -> Tuple[
199
- str,
200
- Union[str, None],
201
- bool,
202
- bool,
203
- bool,
204
- Optional[str],
205
- ]:
206
- """
207
- Method to handle the run subcommand inputs.
208
- :return: User inputs for verbose, target_dir, assessment, is_test, jq & json_target
209
- """
210
-
211
- # Handle json_files input
212
- json_target = retrieve_path_input("json_files")
213
-
214
- # Handle target directory input
215
- target_dir = retrieve_path_input("target directory")
216
-
217
- # Handle verbose input
218
- verbose = retrieve_bool_input("verbose")
219
-
220
- # Handle assessment input
221
- assessment = retrieve_bool_input("assessment")
222
-
223
- # Handle is_test input
224
- is_test = retrieve_bool_input("is_test")
225
-
226
- # Handle jq input
227
- jq = retrieve_jq_input(switch=retrieve_bool_input("jq"))
228
-
229
- return json_target, target_dir, verbose, assessment, is_test, jq
230
-
231
- @staticmethod
232
- def _get_export_controller_menu() -> Tuple[bool, bool, Union[str, None]]:
233
- """
234
- Method to handle the export subcommand inputs.
235
- :return: User inputs for no_pull, verbose & target directory
236
- """
237
-
238
- # Handle target directory input
239
- target_dir = retrieve_path_input("target directory")
240
-
241
- # Handle verbose input
242
- verbose = retrieve_bool_input("verbose")
243
-
244
- # Handle no pull input
245
- no_pull = retrieve_bool_input("--no-pull")
246
-
247
- return no_pull, verbose, target_dir