domino-cli 2.2.0__tar.gz → 2.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 (101) hide show
  1. {domino_cli-2.2.0 → domino_cli-2.4.0}/PKG-INFO +68 -1
  2. {domino_cli-2.2.0 → domino_cli-2.4.0}/README.md +67 -0
  3. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/__init__.py +1 -10
  4. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/ApplicationContext.py +29 -1
  5. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/client/DominoClient.py +9 -2
  6. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/DeployApplicationCommand.py +5 -2
  7. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/HelpCommand.py +9 -0
  8. domino_cli-2.4.0/domino_cli/core/command/ImportCommand.py +29 -0
  9. domino_cli-2.4.0/domino_cli/core/command/SecretCommand.py +41 -0
  10. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLCreate.py +37 -0
  11. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLDelete.py +33 -0
  12. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLLocking.py +59 -0
  13. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLMain.py +68 -0
  14. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLMetadata.py +78 -0
  15. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLRetrieval.py +86 -0
  16. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/DominoCommand.py +10 -0
  17. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/DominoRequest.py +13 -1
  18. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/DominoService.py +34 -12
  19. domino_cli-2.4.0/domino_cli/core/service/SecretService.py +162 -0
  20. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/CoordinatorConfigWizard.py +11 -1
  21. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/InstallerWizard.py +3 -1
  22. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/DockerPlatformComponentInstaller.py +2 -0
  23. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/CoordinatorConfigWizardDataMapping.py +5 -0
  24. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/InstallerWizardDataMapping.py +1 -0
  25. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/CoordinatorConfigWizardResultTransformer.py +6 -1
  26. domino_cli-2.4.0/domino_cli/core/service/wizard/transformer/__init__.py +0 -0
  27. domino_cli-2.4.0/domino_cli/core/util/ResponseUtils.py +29 -0
  28. domino_cli-2.4.0/domino_cli/core/util/__init__.py +0 -0
  29. {domino_cli-2.2.0 → domino_cli-2.4.0}/.gitignore +0 -0
  30. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/__main__.py +0 -0
  31. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/__init__.py +0 -0
  32. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/cli/CLI.py +0 -0
  33. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/cli/Logging.py +0 -0
  34. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/cli/RuntimeHelper.py +0 -0
  35. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/cli/__init__.py +0 -0
  36. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/client/OAuthAuthorizationClient.py +0 -0
  37. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/client/__init__.py +0 -0
  38. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/AbstractCommand.py +0 -0
  39. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/AbstractLifecycleCommand.py +0 -0
  40. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/AuthCommand.py +0 -0
  41. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/ExitCommand.py +0 -0
  42. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/InfoCommand.py +0 -0
  43. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/RestartApplicationCommand.py +0 -0
  44. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/StartApplicationCommand.py +0 -0
  45. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/StopApplicationCommand.py +0 -0
  46. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/WizardCommand.py +0 -0
  47. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/command/__init__.py +0 -0
  48. {domino_cli-2.2.0/domino_cli/core/domain → domino_cli-2.4.0/domino_cli/core/command/dsl}/__init__.py +0 -0
  49. {domino_cli-2.2.0/domino_cli/core/service → domino_cli-2.4.0/domino_cli/core/command/dsl/dsm}/__init__.py +0 -0
  50. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/AuthMode.py +0 -0
  51. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/AuthRequest.py +0 -0
  52. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/CommandDescriptor.py +0 -0
  53. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/HTTPMethod.py +0 -0
  54. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/OAuthConfig.py +0 -0
  55. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/domain/SessionContext.py +0 -0
  56. {domino_cli-2.2.0/domino_cli/core/service/auth → domino_cli-2.4.0/domino_cli/core/domain}/__init__.py +0 -0
  57. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/AuthenticationService.py +0 -0
  58. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/CommandProcessor.py +0 -0
  59. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/ConfigurationWizardService.py +0 -0
  60. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/SessionContextHolder.py +0 -0
  61. {domino_cli-2.2.0/domino_cli/core/service/utility → domino_cli-2.4.0/domino_cli/core/service}/__init__.py +0 -0
  62. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/AbstractAuthHandler.py +0 -0
  63. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/AuthUtils.py +0 -0
  64. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/DirectAuthHandler.py +0 -0
  65. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/OAuthAuthHandler.py +0 -0
  66. {domino_cli-2.2.0/domino_cli/core/service/wizard → domino_cli-2.4.0/domino_cli/core/service/auth}/__init__.py +0 -0
  67. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/utility/BCryptUtil.py +0 -0
  68. {domino_cli-2.2.0/domino_cli/core/service/wizard/mapping → domino_cli-2.4.0/domino_cli/core/service/utility}/__init__.py +0 -0
  69. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/AbstractAgentConfigWizard.py +0 -0
  70. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/AbstractWizard.py +0 -0
  71. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/BinaryExecutableAgentConfigWizard.py +0 -0
  72. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/DeploymentConfigWizard.py +0 -0
  73. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/DockerAgentConfigWizard.py +0 -0
  74. {domino_cli-2.2.0/domino_cli/core/service/wizard/render → domino_cli-2.4.0/domino_cli/core/service/wizard}/__init__.py +0 -0
  75. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/BinaryExecutablePlatformComponentInstaller.py +0 -0
  76. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/DockerVersionResolver.py +0 -0
  77. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/GitHubReleaseVersionResolver.py +0 -0
  78. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/PlatformComponentInstaller.py +0 -0
  79. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/__init__.py +0 -0
  80. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/BinaryExecutableAgentConfigWizardDataMapping.py +0 -0
  81. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/CommonAgentConfigWizardDataMapping.py +0 -0
  82. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/DeploymentConfigWizardDataMapping.py +0 -0
  83. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/DockerAgentConfigWizardDataMapping.py +0 -0
  84. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/WizardDataMappingBaseEnum.py +0 -0
  85. {domino_cli-2.2.0/domino_cli/core/service/wizard/step → domino_cli-2.4.0/domino_cli/core/service/wizard/mapping}/__init__.py +0 -0
  86. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/render/WizardResultConsoleRenderer.py +0 -0
  87. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/render/WizardResultFileRenderer.py +0 -0
  88. {domino_cli-2.2.0/domino_cli/core/service/wizard/transformer → domino_cli-2.4.0/domino_cli/core/service/wizard/render}/__init__.py +0 -0
  89. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/BaseWizardStep.py +0 -0
  90. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/KeyValuePairAnswerWizardStep.py +0 -0
  91. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/MultiAnswerWizardStep.py +0 -0
  92. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/OptionSelectorWizardStep.py +0 -0
  93. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/WizardStep.py +0 -0
  94. {domino_cli-2.2.0/domino_cli/core/util → domino_cli-2.4.0/domino_cli/core/service/wizard/step}/__init__.py +0 -0
  95. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/AbstractWizardResultTransformer.py +0 -0
  96. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/BinaryExecutableAgentConfigWizardResultTransformer.py +0 -0
  97. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/DeploymentConfigWizardResultTransformer.py +0 -0
  98. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/DockerAgentConfigWizardResultTransformer.py +0 -0
  99. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/core/util/ArrayStream.py +0 -0
  100. {domino_cli-2.2.0 → domino_cli-2.4.0}/domino_cli/installer_config.py +0 -0
  101. {domino_cli-2.2.0 → domino_cli-2.4.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: domino-cli
3
- Version: 2.2.0
3
+ Version: 2.4.0
4
4
  Summary: Domino Platform CLI tool, providing utilities to install, configure and control your Domino Platform insfrastructure
5
5
  Project-URL: Maintainer's website, https://psprog.hu
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -184,6 +184,73 @@ info <app>
184
184
  ```
185
185
  Instructs Domino to query the application's info endpoint and returns the results.
186
186
 
187
+ ### Deployment definition management commands
188
+
189
+ ```
190
+ import <optional/path/to/deployment-definition.yml>
191
+ ```
192
+ Imports a YAML formatted deployment definition. Without providing an absolute or relative path to your deployment
193
+ definition file, defaults to `.domino/deployment.yml`.
194
+
195
+ ### Secret management commands
196
+
197
+ Domino Coordinator, starting with v2.3.0, can act as a simple secret manager. Domino CLI provides an integration for
198
+ these operations. Please note, that most of the commands do not support CI/CD mode, except for the --retrieve commands.
199
+
200
+ ```
201
+ secret --create <key> <context>
202
+ ```
203
+ Creates a new secret. You'll need to provide the secret key and a context (basically a group) name for the secret as
204
+ arguments, then you'll be prompted to enter the secret value, without echoing the value to the terminal.
205
+ Notes:
206
+ * Context is an arbitrary value, that lets you return multiple, corresponding secrets with a single request.
207
+ * Created secrets are by default "locked", meaning they can't be returned via the API (only accessible by Domino
208
+ Coordinator directly, for deployment definitions).
209
+
210
+ ```
211
+ secret --metadata --all
212
+ ```
213
+ Returns the metadata of all existing secrets, grouped by their context.
214
+
215
+ ```
216
+ secret --metadata <key>
217
+ ```
218
+ Returns the metadata of the given secret.
219
+
220
+ ```
221
+ secret --retrieve --key <key>
222
+ ```
223
+ Returns the value of the given secret, if retrievable. In CI/CD mode, the result is returned in `<key>=<value>` format,
224
+ that can be put in a `.env` file directly.
225
+
226
+ ```
227
+ secret --retrieve --context <context>
228
+ ```
229
+ Returns the value of all secrets under the given context, if each of them is retrievable. In CI/CD mode, the result is
230
+ returned in `<key>=<value>` format, that can be used in a `.env` file directly. E.g.:
231
+ ```
232
+ $ domino-cli --cicd secret --retrieve --context config > .env
233
+ $ cat .env
234
+ datasource.host=jdbc:mysql://localhost:3306/test
235
+ datasource.username=root
236
+ ...
237
+ ```
238
+
239
+ ```
240
+ secret --lock <key>
241
+ ```
242
+ Locks (disables retrieval of) the given secret.
243
+
244
+ ```
245
+ secret --unlock <key>
246
+ ```
247
+ Unlocks (enables retrieval of) the given secret.
248
+
249
+ ```
250
+ secret --delete <key>
251
+ ```
252
+ Deletes the given secret.
253
+
187
254
  ### Configuration wizards
188
255
 
189
256
  Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
@@ -166,6 +166,73 @@ info <app>
166
166
  ```
167
167
  Instructs Domino to query the application's info endpoint and returns the results.
168
168
 
169
+ ### Deployment definition management commands
170
+
171
+ ```
172
+ import <optional/path/to/deployment-definition.yml>
173
+ ```
174
+ Imports a YAML formatted deployment definition. Without providing an absolute or relative path to your deployment
175
+ definition file, defaults to `.domino/deployment.yml`.
176
+
177
+ ### Secret management commands
178
+
179
+ Domino Coordinator, starting with v2.3.0, can act as a simple secret manager. Domino CLI provides an integration for
180
+ these operations. Please note, that most of the commands do not support CI/CD mode, except for the --retrieve commands.
181
+
182
+ ```
183
+ secret --create <key> <context>
184
+ ```
185
+ Creates a new secret. You'll need to provide the secret key and a context (basically a group) name for the secret as
186
+ arguments, then you'll be prompted to enter the secret value, without echoing the value to the terminal.
187
+ Notes:
188
+ * Context is an arbitrary value, that lets you return multiple, corresponding secrets with a single request.
189
+ * Created secrets are by default "locked", meaning they can't be returned via the API (only accessible by Domino
190
+ Coordinator directly, for deployment definitions).
191
+
192
+ ```
193
+ secret --metadata --all
194
+ ```
195
+ Returns the metadata of all existing secrets, grouped by their context.
196
+
197
+ ```
198
+ secret --metadata <key>
199
+ ```
200
+ Returns the metadata of the given secret.
201
+
202
+ ```
203
+ secret --retrieve --key <key>
204
+ ```
205
+ Returns the value of the given secret, if retrievable. In CI/CD mode, the result is returned in `<key>=<value>` format,
206
+ that can be put in a `.env` file directly.
207
+
208
+ ```
209
+ secret --retrieve --context <context>
210
+ ```
211
+ Returns the value of all secrets under the given context, if each of them is retrievable. In CI/CD mode, the result is
212
+ returned in `<key>=<value>` format, that can be used in a `.env` file directly. E.g.:
213
+ ```
214
+ $ domino-cli --cicd secret --retrieve --context config > .env
215
+ $ cat .env
216
+ datasource.host=jdbc:mysql://localhost:3306/test
217
+ datasource.username=root
218
+ ...
219
+ ```
220
+
221
+ ```
222
+ secret --lock <key>
223
+ ```
224
+ Locks (disables retrieval of) the given secret.
225
+
226
+ ```
227
+ secret --unlock <key>
228
+ ```
229
+ Unlocks (enables retrieval of) the given secret.
230
+
231
+ ```
232
+ secret --delete <key>
233
+ ```
234
+ Deletes the given secret.
235
+
169
236
  ### Configuration wizards
170
237
 
171
238
  Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
@@ -2,19 +2,10 @@
2
2
  domino_cli.py :: Main entry point for Domino CLI application.
3
3
  """
4
4
 
5
- __version__ = "2.2.0"
6
-
7
- import os
5
+ __version__ = "2.4.0"
8
6
 
9
7
  from domino_cli.core.ApplicationContext import ApplicationContext
10
8
 
11
9
 
12
- def _set_work_dir() -> None:
13
- script_path: str = os.path.realpath(__file__)
14
- script_dir: str = os.path.dirname(script_path)
15
- os.chdir(script_dir)
16
-
17
-
18
10
  def main() -> None:
19
- _set_work_dir()
20
11
  ApplicationContext.init_cli(__version__).run_loop()
@@ -8,17 +8,28 @@ from domino_cli.core.command.AuthCommand import AuthCommand
8
8
  from domino_cli.core.command.DeployApplicationCommand import DeployApplicationCommand
9
9
  from domino_cli.core.command.ExitCommand import ExitCommand
10
10
  from domino_cli.core.command.HelpCommand import HelpCommand
11
+ from domino_cli.core.command.ImportCommand import ImportCommand
11
12
  from domino_cli.core.command.InfoCommand import InfoCommand
12
13
  from domino_cli.core.command.RestartApplicationCommand import RestartApplicationCommand
14
+ from domino_cli.core.command.SecretCommand import SecretCommand
13
15
  from domino_cli.core.command.StartApplicationCommand import StartApplicationCommand
14
16
  from domino_cli.core.command.StopApplicationCommand import StopApplicationCommand
15
17
  from domino_cli.core.command.WizardCommand import WizardCommand
18
+ from domino_cli.core.command.dsl.dsm.DSLCreate import CreateSecretCommandProcessor
19
+ from domino_cli.core.command.dsl.dsm.DSLDelete import DeleteSecretCommandProcessor
20
+ from domino_cli.core.command.dsl.dsm.DSLLocking import LockSecretCommandProcessor, UnlockSecretCommandProcessor
21
+ from domino_cli.core.command.dsl.dsm.DSLMain import MainSecretCommandProcessor
22
+ from domino_cli.core.command.dsl.dsm.DSLMetadata import MetadataCommandProcessor, MetadataAllCommandProcessor, \
23
+ MetadataKeyCommandProcessor
24
+ from domino_cli.core.command.dsl.dsm.DSLRetrieval import RetrievalSecretCommandProcessor, \
25
+ RetrieveByKeySecretCommandProcessor, RetrieveByContextSecretCommandProcessor
16
26
  from domino_cli.core.domain.AuthMode import AuthMode
17
27
  from domino_cli.core.domain.OAuthConfig import OAuthConfig
18
28
  from domino_cli.core.service.AuthenticationService import AuthenticationService
19
29
  from domino_cli.core.service.CommandProcessor import CommandProcessor
20
30
  from domino_cli.core.service.ConfigurationWizardService import ConfigurationWizardService
21
31
  from domino_cli.core.service.DominoService import DominoService
32
+ from domino_cli.core.service.SecretService import SecretService
22
33
  from domino_cli.core.service.SessionContextHolder import SessionContextHolder
23
34
  from domino_cli.core.service.auth.DirectAuthHandler import DirectAuthHandler
24
35
  from domino_cli.core.service.auth.OAuthAuthHandler import OAuthAuthHandler
@@ -90,6 +101,7 @@ class ApplicationContext:
90
101
  _domino_client = DominoClient(_domino_base_url, _session_context_holder)
91
102
  _oauth_authorization_client = OAuthAuthorizationClient(_oauth_config)
92
103
  _domino_service = DominoService(_domino_client)
104
+ _secret_service = SecretService(_domino_client)
93
105
  _direct_auth_handler = DirectAuthHandler(_domino_client)
94
106
  _oauth_auth_handler = OAuthAuthHandler(_oauth_config, _oauth_authorization_client)
95
107
  _auth_service = AuthenticationService(_default_auth_mode, _session_context_holder, [
@@ -111,9 +123,23 @@ class ApplicationContext:
111
123
  _command_stop_app = StopApplicationCommand(_domino_service)
112
124
  _command_restart_app = RestartApplicationCommand(_domino_service)
113
125
  _command_deploy_app = DeployApplicationCommand(_domino_service)
126
+ _command_import = ImportCommand(_domino_service)
114
127
  _command_auth = AuthCommand(_auth_service)
115
128
  _command_wizard = WizardCommand(_config_wizard_service)
116
129
  _command_info = InfoCommand(_domino_service)
130
+ _command_secret = SecretCommand([
131
+ MainSecretCommandProcessor(),
132
+ CreateSecretCommandProcessor(_secret_service),
133
+ MetadataCommandProcessor(),
134
+ MetadataAllCommandProcessor(_secret_service),
135
+ MetadataKeyCommandProcessor(_secret_service),
136
+ RetrievalSecretCommandProcessor(),
137
+ RetrieveByKeySecretCommandProcessor(_secret_service),
138
+ RetrieveByContextSecretCommandProcessor(_secret_service),
139
+ LockSecretCommandProcessor(_secret_service),
140
+ UnlockSecretCommandProcessor(_secret_service),
141
+ DeleteSecretCommandProcessor(_secret_service),
142
+ ])
117
143
 
118
144
  # command processor
119
145
  _command_processor = CommandProcessor(_command_help, [
@@ -124,8 +150,10 @@ class ApplicationContext:
124
150
  _command_restart_app,
125
151
  _command_start_app,
126
152
  _command_stop_app,
153
+ _command_import,
127
154
  _command_wizard,
128
- _command_info
155
+ _command_info,
156
+ _command_secret
129
157
  ])
130
158
 
131
159
  _cli = CLI(_command_processor)
@@ -26,7 +26,14 @@ class DominoClient:
26
26
  :return: Response object
27
27
  """
28
28
  resolved_path = urllib.parse.urljoin(self._domino_base_url, domino_request.path)
29
- json_body = domino_request.body
29
+ headers = {"Content-Type": "text/plain"} \
30
+ if domino_request.as_text \
31
+ else {"Content-Type": "application/json"}
30
32
  auth = self._session_context_holder.get_bearer_auth() if domino_request.authenticated else None
31
33
 
32
- return requests.request(domino_request.method.value, resolved_path, json=json_body, headers=auth)
34
+ if auth:
35
+ headers.update(auth)
36
+
37
+ return requests.request(domino_request.method.value, resolved_path, headers=headers,
38
+ json=None if domino_request.as_text else domino_request.body,
39
+ data=domino_request.body if domino_request.as_text else None)
@@ -1,4 +1,5 @@
1
- from domino_cli.core.cli.Logging import warning
1
+ from domino_cli.core.cli.Logging import error
2
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
2
3
  from domino_cli.core.command.AbstractCommand import AbstractCommand
3
4
  from domino_cli.core.domain.CommandDescriptor import CommandDescriptor
4
5
  from domino_cli.core.domain.DominoCommand import DominoCommand
@@ -26,7 +27,9 @@ class DeployApplicationCommand(AbstractCommand):
26
27
  :param command_descriptor: CommandDescriptor object containing the command arguments
27
28
  """
28
29
  if not len(command_descriptor.arguments) == 2:
29
- warning("Application name and 'latest' keyword or explicit version is required")
30
+ error("Application name and 'latest' keyword or explicit version is required")
31
+ RuntimeHelper.exit_with_error_in_cicd_mode()
32
+
30
33
  else:
31
34
  application: str = command_descriptor.arguments[0]
32
35
  version: str = command_descriptor.arguments[1]
@@ -13,6 +13,15 @@ Known commands:
13
13
  --generate-token: authenticates with Domino and prints the generated token
14
14
  --open-session: authenticates with Domino and stores the token in the session context for further usage
15
15
  --set-mode <oauth|direct>: switches authentication mode (oauth or direct)
16
+ - secret <arguments>: secret management operations
17
+ --metadata --all: retrieves metadata of all existing secrets
18
+ --metadata <key>: retrieves metadata of the given secret
19
+ --retrieve --key <key>: retrieves the value of the given secret
20
+ --retrieve --context <context>: retrieves the value of all secrets under the given context
21
+ --create <key> <context>: create a new secret (you'll be prompted to enter the secret value as password)
22
+ --lock <key>: locks a secret (disables retrieval)
23
+ --unlock <key>: unlocks a secret (enables retrieval)
24
+ --delete <key>: deletes a secret
16
25
  - start <app>: commands Domino to start the given app
17
26
  - stop <app>: commands Domino to stop the given app
18
27
  - restart <app>: commands Domino to restart the given app
@@ -0,0 +1,29 @@
1
+ from domino_cli.core.cli.Logging import error
2
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
3
+ from domino_cli.core.command.AbstractCommand import AbstractCommand
4
+ from domino_cli.core.domain.CommandDescriptor import CommandDescriptor
5
+ from domino_cli.core.service.DominoService import DominoService
6
+
7
+ _COMMAND_NAME = "import"
8
+
9
+
10
+ class ImportCommand(AbstractCommand):
11
+ """
12
+ Command implementation to import a deployment definition from static YAML configuration file.
13
+ """
14
+ def __init__(self, domino_service: DominoService):
15
+ super().__init__(_COMMAND_NAME)
16
+ self._domino_service = domino_service
17
+
18
+ def execute_command(self, command_descriptor: CommandDescriptor) -> None:
19
+
20
+ if len(command_descriptor.arguments) > 1:
21
+ error("Too many arguments, expected command usage is 'import optional/path/to/deployment.yml' (defaults to '.domino/deployment.yml' without argument)")
22
+ RuntimeHelper.exit_with_error_in_cicd_mode()
23
+ return
24
+
25
+ definition_path = command_descriptor.arguments[0] \
26
+ if len(command_descriptor.arguments) == 1 \
27
+ else None
28
+
29
+ self._domino_service.import_definition(definition_path)
@@ -0,0 +1,41 @@
1
+ from typing import List
2
+
3
+ from domino_cli.core.cli.Logging import error
4
+ from domino_cli.core.command.AbstractCommand import AbstractCommand
5
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
6
+ from domino_cli.core.domain.CommandDescriptor import CommandDescriptor
7
+
8
+ _command_processing_max_iteration = 4
9
+
10
+ _COMMAND_NAME = "secret"
11
+
12
+
13
+ class SecretCommand(AbstractCommand):
14
+ """
15
+ Command implementation to execute a Domino Secret Manager request.
16
+ """
17
+ def __init__(self, processors: List[SecretCommandProcessor]):
18
+ super().__init__(_COMMAND_NAME)
19
+ self._processors = {processor.for_subcommand(): processor for processor in processors}
20
+
21
+ def execute_command(self, command_descriptor: CommandDescriptor) -> None:
22
+
23
+ command_arguments = command_descriptor.arguments.copy()
24
+ current_argument = "secret"
25
+ processed = False
26
+
27
+ for _ in range(_command_processing_max_iteration):
28
+
29
+ processor = self._processors.get(current_argument)
30
+ processed = processor.process(command_arguments)
31
+
32
+ if processed:
33
+ break
34
+
35
+ current_argument = processor.chain_to(command_arguments)
36
+
37
+ if current_argument is None:
38
+ break
39
+
40
+ if not processed:
41
+ error("Domino CLI was not able to process your secret management request")
@@ -0,0 +1,37 @@
1
+ from getpass import getpass
2
+ from typing import List
3
+
4
+ from domino_cli.core.cli.Logging import error
5
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
6
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
7
+ from domino_cli.core.service.SecretService import SecretService
8
+
9
+
10
+ class CreateSecretCommandProcessor(SecretCommandProcessor):
11
+ """
12
+ SecretCommandProcessor implementation to process the --create <key> <context> secret management command.
13
+ """
14
+ def __init__(self, secret_service: SecretService):
15
+ self._secret_service = secret_service
16
+
17
+ def process(self, arguments: List[str]) -> bool:
18
+
19
+ RuntimeHelper.unsupported_in_cicd_mode()
20
+
21
+ if not len(arguments) == 2:
22
+ error("Invalid arguments, expected usage: secret --create <key> <context> (then you'll be prompted to enter the secret value)")
23
+ return False
24
+
25
+ key = arguments.pop(0)
26
+ context = arguments.pop(0)
27
+ value = RuntimeHelper.input_wrapper(lambda: getpass('Enter secret value > '))
28
+
29
+ self._secret_service.create_secret(key, context, value)
30
+
31
+ return True
32
+
33
+ def chain_to(self, arguments: List[str]) -> str | None:
34
+ return None
35
+
36
+ def for_subcommand(self) -> str:
37
+ return "--create"
@@ -0,0 +1,33 @@
1
+ from typing import List
2
+
3
+ from domino_cli.core.cli.Logging import error
4
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
5
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
6
+ from domino_cli.core.service.SecretService import SecretService
7
+
8
+
9
+ class DeleteSecretCommandProcessor(SecretCommandProcessor):
10
+ """
11
+ SecretCommandProcessor implementation to process the --delete <key> secret management command.
12
+ """
13
+ def __init__(self, secret_service: SecretService):
14
+ self._secret_service = secret_service
15
+
16
+ def process(self, arguments: List[str]) -> bool:
17
+
18
+ RuntimeHelper.unsupported_in_cicd_mode()
19
+
20
+ if not len(arguments) == 1:
21
+ error("Invalid arguments, expected usage: secret --delete <key>")
22
+ return False
23
+
24
+ key = arguments.pop(0)
25
+ self._secret_service.delete_secret(key)
26
+
27
+ return True
28
+
29
+ def chain_to(self, arguments: List[str]) -> str | None:
30
+ return None
31
+
32
+ def for_subcommand(self) -> str:
33
+ return "--delete"
@@ -0,0 +1,59 @@
1
+ from typing import List
2
+
3
+ from domino_cli.core.cli.Logging import error
4
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
5
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
6
+ from domino_cli.core.service.SecretService import SecretService
7
+
8
+
9
+ class LockSecretCommandProcessor(SecretCommandProcessor):
10
+ """
11
+ SecretCommandProcessor implementation to process the --lock <key> secret management command.
12
+ """
13
+ def __init__(self, secret_service: SecretService):
14
+ self._secret_service = secret_service
15
+
16
+ def process(self, arguments: List[str]) -> bool:
17
+
18
+ RuntimeHelper.unsupported_in_cicd_mode()
19
+
20
+ if not len(arguments) == 1:
21
+ error("Invalid arguments, expected usage: secret --lock <key>")
22
+ return False
23
+
24
+ key = arguments.pop(0)
25
+ self._secret_service.lock_secret(key)
26
+
27
+ return True
28
+
29
+ def chain_to(self, arguments: List[str]) -> str | None:
30
+ return None
31
+
32
+ def for_subcommand(self) -> str:
33
+ return "--lock"
34
+
35
+ class UnlockSecretCommandProcessor(SecretCommandProcessor):
36
+ """
37
+ SecretCommandProcessor implementation to process the --unlock <key> secret management command.
38
+ """
39
+ def __init__(self, secret_service: SecretService):
40
+ self._secret_service = secret_service
41
+
42
+ def process(self, arguments: List[str]) -> bool:
43
+
44
+ RuntimeHelper.unsupported_in_cicd_mode()
45
+
46
+ if not len(arguments) == 1:
47
+ error("Invalid arguments, expected usage: secret --unlock <key>")
48
+ return False
49
+
50
+ key = arguments.pop(0)
51
+ self._secret_service.unlock_secret(key)
52
+
53
+ return True
54
+
55
+ def chain_to(self, arguments: List[str]) -> str | None:
56
+ return None
57
+
58
+ def for_subcommand(self) -> str:
59
+ return "--unlock"
@@ -0,0 +1,68 @@
1
+ from abc import ABCMeta, abstractmethod
2
+ from typing import List
3
+
4
+ from domino_cli.core.cli.Logging import error
5
+
6
+
7
+ class SecretCommandProcessor(object, metaclass=ABCMeta):
8
+ """
9
+ DSL processor interface for secret management commands.
10
+ """
11
+ @abstractmethod
12
+ def process(self, arguments: List[str]) -> bool:
13
+ """
14
+ Final state of the command, executes the recognized management operation.
15
+
16
+ :param arguments: current command argument list
17
+ :return: boolean flag indicating if the command was processed
18
+ """
19
+ pass
20
+
21
+ @abstractmethod
22
+ def chain_to(self, arguments: List[str]) -> str | None:
23
+ """
24
+ Defines the further chaining logic. Returns none if further chaining is not possible either because of an error,
25
+ or if the chain reached a final state. May drop the first argument of the list.
26
+
27
+ :param arguments: current command argument list
28
+ :return: next processor name or None if further chaining is not possible
29
+ """
30
+ pass
31
+
32
+ @abstractmethod
33
+ def for_subcommand(self) -> str:
34
+ """
35
+ Indicates the processor name to be used in chaining.
36
+
37
+ :return: processor name
38
+ """
39
+ pass
40
+
41
+ class MainSecretCommandProcessor(SecretCommandProcessor):
42
+ """
43
+ Main command processor, i.e. the entry point of secret management command processing. Entry argument token is
44
+ "secret", and may move on to any of the known commands (--create, --metadata, --retrieve, --lock, --unlock, --delete).
45
+ """
46
+
47
+ valid_subcommands = ["--create", "--metadata", "--retrieve", "--lock", "--unlock", "--delete"]
48
+
49
+ def process(self, arguments: List[str]) -> bool:
50
+ return False
51
+
52
+ def chain_to(self, arguments: List[str]) -> str | None:
53
+
54
+ if len(arguments) == 0:
55
+ error(f"Too few arguments, first argument must be either: {" | ".join(self.valid_subcommands)}")
56
+ return None
57
+
58
+ subcommand = arguments.pop(0)
59
+
60
+ if subcommand not in self.valid_subcommands:
61
+ error(f"Invalid subcommand, first argument must be either: {" | ".join(self.valid_subcommands)}")
62
+ return None
63
+
64
+ else:
65
+ return subcommand
66
+
67
+ def for_subcommand(self) -> str:
68
+ return "secret"
@@ -0,0 +1,78 @@
1
+ from typing import List
2
+
3
+ from domino_cli.core.cli.Logging import error
4
+ from domino_cli.core.cli.RuntimeHelper import RuntimeHelper
5
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
6
+ from domino_cli.core.service.SecretService import SecretService
7
+
8
+
9
+ class MetadataCommandProcessor(SecretCommandProcessor):
10
+ """
11
+ SecretCommandProcessor implementation to process the --metadata secret management command. Chains forward to --all
12
+ and <key> subcommands.
13
+ """
14
+
15
+ def process(self, arguments: List[str]) -> bool:
16
+
17
+ RuntimeHelper.unsupported_in_cicd_mode()
18
+
19
+ return False
20
+
21
+ def chain_to(self, arguments: List[str]) -> str | None:
22
+
23
+ if len(arguments) == 0:
24
+ error(f"Too few arguments, first argument must be either: --all | <key>")
25
+ return None
26
+
27
+ return "--metadata --all" \
28
+ if arguments[0] == "--all" \
29
+ else "--metadata <key>"
30
+
31
+ def for_subcommand(self) -> str:
32
+ return "--metadata"
33
+
34
+ class MetadataAllCommandProcessor(SecretCommandProcessor):
35
+ """
36
+ SecretCommandProcessor implementation to process the --metadata --all secret management command.
37
+ """
38
+ def __init__(self, secret_service: SecretService):
39
+ self._secret_service = secret_service
40
+
41
+ def process(self, arguments: List[str]) -> bool:
42
+
43
+ RuntimeHelper.unsupported_in_cicd_mode()
44
+ self._secret_service.get_all_metadata()
45
+
46
+ return True
47
+
48
+ def chain_to(self, arguments: List[str]) -> str | None:
49
+ return None
50
+
51
+ def for_subcommand(self) -> str:
52
+ return "--metadata --all"
53
+
54
+ class MetadataKeyCommandProcessor(SecretCommandProcessor):
55
+ """
56
+ SecretCommandProcessor implementation to process the --metadata <key> secret management command.
57
+ """
58
+ def __init__(self, secret_service: SecretService):
59
+ self._secret_service = secret_service
60
+
61
+ def process(self, arguments: List[str]) -> bool:
62
+
63
+ RuntimeHelper.unsupported_in_cicd_mode()
64
+
65
+ if not len(arguments) == 1:
66
+ error("Invalid arguments, expected usage: secret --metadata <key>")
67
+ return False
68
+
69
+ key = arguments.pop(0)
70
+ self._secret_service.get_metadata_by_key(key)
71
+
72
+ return True
73
+
74
+ def chain_to(self, arguments: List[str]) -> str | None:
75
+ return None
76
+
77
+ def for_subcommand(self) -> str:
78
+ return "--metadata <key>"