domino-cli 2.3.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.3.0 → domino_cli-2.4.0}/PKG-INFO +60 -1
  2. {domino_cli-2.3.0 → domino_cli-2.4.0}/README.md +59 -0
  3. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/__init__.py +1 -1
  4. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/ApplicationContext.py +26 -1
  5. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/HelpCommand.py +9 -0
  6. domino_cli-2.4.0/domino_cli/core/command/SecretCommand.py +41 -0
  7. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLCreate.py +37 -0
  8. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLDelete.py +33 -0
  9. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLLocking.py +59 -0
  10. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLMain.py +68 -0
  11. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLMetadata.py +78 -0
  12. domino_cli-2.4.0/domino_cli/core/command/dsl/dsm/DSLRetrieval.py +86 -0
  13. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/DominoCommand.py +9 -0
  14. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/DominoRequest.py +11 -0
  15. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/DominoService.py +5 -21
  16. domino_cli-2.4.0/domino_cli/core/service/SecretService.py +162 -0
  17. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/CoordinatorConfigWizard.py +11 -1
  18. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/InstallerWizard.py +3 -1
  19. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/DockerPlatformComponentInstaller.py +2 -0
  20. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/CoordinatorConfigWizardDataMapping.py +5 -0
  21. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/InstallerWizardDataMapping.py +1 -0
  22. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/CoordinatorConfigWizardResultTransformer.py +6 -1
  23. domino_cli-2.4.0/domino_cli/core/service/wizard/transformer/__init__.py +0 -0
  24. domino_cli-2.4.0/domino_cli/core/util/ResponseUtils.py +29 -0
  25. domino_cli-2.4.0/domino_cli/core/util/__init__.py +0 -0
  26. {domino_cli-2.3.0 → domino_cli-2.4.0}/.gitignore +0 -0
  27. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/__main__.py +0 -0
  28. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/__init__.py +0 -0
  29. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/cli/CLI.py +0 -0
  30. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/cli/Logging.py +0 -0
  31. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/cli/RuntimeHelper.py +0 -0
  32. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/cli/__init__.py +0 -0
  33. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/client/DominoClient.py +0 -0
  34. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/client/OAuthAuthorizationClient.py +0 -0
  35. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/client/__init__.py +0 -0
  36. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/AbstractCommand.py +0 -0
  37. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/AbstractLifecycleCommand.py +0 -0
  38. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/AuthCommand.py +0 -0
  39. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/DeployApplicationCommand.py +0 -0
  40. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/ExitCommand.py +0 -0
  41. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/ImportCommand.py +0 -0
  42. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/InfoCommand.py +0 -0
  43. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/RestartApplicationCommand.py +0 -0
  44. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/StartApplicationCommand.py +0 -0
  45. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/StopApplicationCommand.py +0 -0
  46. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/WizardCommand.py +0 -0
  47. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/command/__init__.py +0 -0
  48. {domino_cli-2.3.0/domino_cli/core/domain → domino_cli-2.4.0/domino_cli/core/command/dsl}/__init__.py +0 -0
  49. {domino_cli-2.3.0/domino_cli/core/service → domino_cli-2.4.0/domino_cli/core/command/dsl/dsm}/__init__.py +0 -0
  50. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/AuthMode.py +0 -0
  51. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/AuthRequest.py +0 -0
  52. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/CommandDescriptor.py +0 -0
  53. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/HTTPMethod.py +0 -0
  54. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/OAuthConfig.py +0 -0
  55. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/domain/SessionContext.py +0 -0
  56. {domino_cli-2.3.0/domino_cli/core/service/auth → domino_cli-2.4.0/domino_cli/core/domain}/__init__.py +0 -0
  57. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/AuthenticationService.py +0 -0
  58. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/CommandProcessor.py +0 -0
  59. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/ConfigurationWizardService.py +0 -0
  60. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/SessionContextHolder.py +0 -0
  61. {domino_cli-2.3.0/domino_cli/core/service/utility → domino_cli-2.4.0/domino_cli/core/service}/__init__.py +0 -0
  62. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/AbstractAuthHandler.py +0 -0
  63. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/AuthUtils.py +0 -0
  64. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/DirectAuthHandler.py +0 -0
  65. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/auth/OAuthAuthHandler.py +0 -0
  66. {domino_cli-2.3.0/domino_cli/core/service/wizard → domino_cli-2.4.0/domino_cli/core/service/auth}/__init__.py +0 -0
  67. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/utility/BCryptUtil.py +0 -0
  68. {domino_cli-2.3.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.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/AbstractAgentConfigWizard.py +0 -0
  70. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/AbstractWizard.py +0 -0
  71. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/BinaryExecutableAgentConfigWizard.py +0 -0
  72. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/DeploymentConfigWizard.py +0 -0
  73. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/DockerAgentConfigWizard.py +0 -0
  74. {domino_cli-2.3.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.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/BinaryExecutablePlatformComponentInstaller.py +0 -0
  76. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/DockerVersionResolver.py +0 -0
  77. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/GitHubReleaseVersionResolver.py +0 -0
  78. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/PlatformComponentInstaller.py +0 -0
  79. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/installer/__init__.py +0 -0
  80. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/BinaryExecutableAgentConfigWizardDataMapping.py +0 -0
  81. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/CommonAgentConfigWizardDataMapping.py +0 -0
  82. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/DeploymentConfigWizardDataMapping.py +0 -0
  83. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/DockerAgentConfigWizardDataMapping.py +0 -0
  84. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/mapping/WizardDataMappingBaseEnum.py +0 -0
  85. {domino_cli-2.3.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.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/render/WizardResultConsoleRenderer.py +0 -0
  87. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/render/WizardResultFileRenderer.py +0 -0
  88. {domino_cli-2.3.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.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/BaseWizardStep.py +0 -0
  90. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/KeyValuePairAnswerWizardStep.py +0 -0
  91. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/MultiAnswerWizardStep.py +0 -0
  92. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/OptionSelectorWizardStep.py +0 -0
  93. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/step/WizardStep.py +0 -0
  94. {domino_cli-2.3.0/domino_cli/core/util → domino_cli-2.4.0/domino_cli/core/service/wizard/step}/__init__.py +0 -0
  95. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/AbstractWizardResultTransformer.py +0 -0
  96. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/BinaryExecutableAgentConfigWizardResultTransformer.py +0 -0
  97. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/DeploymentConfigWizardResultTransformer.py +0 -0
  98. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/service/wizard/transformer/DockerAgentConfigWizardResultTransformer.py +0 -0
  99. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/core/util/ArrayStream.py +0 -0
  100. {domino_cli-2.3.0 → domino_cli-2.4.0}/domino_cli/installer_config.py +0 -0
  101. {domino_cli-2.3.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.3.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
@@ -192,6 +192,65 @@ import <optional/path/to/deployment-definition.yml>
192
192
  Imports a YAML formatted deployment definition. Without providing an absolute or relative path to your deployment
193
193
  definition file, defaults to `.domino/deployment.yml`.
194
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
+
195
254
  ### Configuration wizards
196
255
 
197
256
  Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
@@ -174,6 +174,65 @@ import <optional/path/to/deployment-definition.yml>
174
174
  Imports a YAML formatted deployment definition. Without providing an absolute or relative path to your deployment
175
175
  definition file, defaults to `.domino/deployment.yml`.
176
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
+
177
236
  ### Configuration wizards
178
237
 
179
238
  Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
@@ -2,7 +2,7 @@
2
2
  domino_cli.py :: Main entry point for Domino CLI application.
3
3
  """
4
4
 
5
- __version__ = "2.3.0"
5
+ __version__ = "2.4.0"
6
6
 
7
7
  from domino_cli.core.ApplicationContext import ApplicationContext
8
8
 
@@ -11,15 +11,25 @@ from domino_cli.core.command.HelpCommand import HelpCommand
11
11
  from domino_cli.core.command.ImportCommand import ImportCommand
12
12
  from domino_cli.core.command.InfoCommand import InfoCommand
13
13
  from domino_cli.core.command.RestartApplicationCommand import RestartApplicationCommand
14
+ from domino_cli.core.command.SecretCommand import SecretCommand
14
15
  from domino_cli.core.command.StartApplicationCommand import StartApplicationCommand
15
16
  from domino_cli.core.command.StopApplicationCommand import StopApplicationCommand
16
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
17
26
  from domino_cli.core.domain.AuthMode import AuthMode
18
27
  from domino_cli.core.domain.OAuthConfig import OAuthConfig
19
28
  from domino_cli.core.service.AuthenticationService import AuthenticationService
20
29
  from domino_cli.core.service.CommandProcessor import CommandProcessor
21
30
  from domino_cli.core.service.ConfigurationWizardService import ConfigurationWizardService
22
31
  from domino_cli.core.service.DominoService import DominoService
32
+ from domino_cli.core.service.SecretService import SecretService
23
33
  from domino_cli.core.service.SessionContextHolder import SessionContextHolder
24
34
  from domino_cli.core.service.auth.DirectAuthHandler import DirectAuthHandler
25
35
  from domino_cli.core.service.auth.OAuthAuthHandler import OAuthAuthHandler
@@ -91,6 +101,7 @@ class ApplicationContext:
91
101
  _domino_client = DominoClient(_domino_base_url, _session_context_holder)
92
102
  _oauth_authorization_client = OAuthAuthorizationClient(_oauth_config)
93
103
  _domino_service = DominoService(_domino_client)
104
+ _secret_service = SecretService(_domino_client)
94
105
  _direct_auth_handler = DirectAuthHandler(_domino_client)
95
106
  _oauth_auth_handler = OAuthAuthHandler(_oauth_config, _oauth_authorization_client)
96
107
  _auth_service = AuthenticationService(_default_auth_mode, _session_context_holder, [
@@ -116,6 +127,19 @@ class ApplicationContext:
116
127
  _command_auth = AuthCommand(_auth_service)
117
128
  _command_wizard = WizardCommand(_config_wizard_service)
118
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
+ ])
119
143
 
120
144
  # command processor
121
145
  _command_processor = CommandProcessor(_command_help, [
@@ -128,7 +152,8 @@ class ApplicationContext:
128
152
  _command_stop_app,
129
153
  _command_import,
130
154
  _command_wizard,
131
- _command_info
155
+ _command_info,
156
+ _command_secret
132
157
  ])
133
158
 
134
159
  _cli = CLI(_command_processor)
@@ -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,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>"
@@ -0,0 +1,86 @@
1
+ from typing import List
2
+
3
+ from domino_cli.core.cli.Logging import error
4
+ from domino_cli.core.command.dsl.dsm.DSLMain import SecretCommandProcessor
5
+ from domino_cli.core.service.SecretService import SecretService
6
+
7
+
8
+ class RetrievalSecretCommandProcessor(SecretCommandProcessor):
9
+ """
10
+ SecretCommandProcessor implementation to process the --retrieve secret management command. Chains forward to --key
11
+ or --context subcommands.
12
+ """
13
+
14
+ valid_subcommands = ["--key", "--context"]
15
+
16
+ def process(self, arguments: List[str]) -> bool:
17
+ return False
18
+
19
+ def chain_to(self, arguments: List[str]) -> str | None:
20
+
21
+ if len(arguments) < 1:
22
+ error(f"Too few arguments, must be either: --key <key> | --context <context>")
23
+ return None
24
+
25
+ if len(arguments) > 2:
26
+ error(f"Too many arguments, must be either: --key <key> | --context <context>")
27
+ return None
28
+
29
+ subcommand = arguments.pop(0)
30
+
31
+ if subcommand not in self.valid_subcommands:
32
+ error(f"Invalid subcommand, first argument must be either: {" | ".join(self.valid_subcommands)}")
33
+ return None
34
+
35
+ return f"--retrieve {subcommand}"
36
+
37
+ def for_subcommand(self) -> str:
38
+ return "--retrieve"
39
+
40
+ class RetrieveByKeySecretCommandProcessor(SecretCommandProcessor):
41
+ """
42
+ SecretCommandProcessor implementation to process the --retrieve --key <key> secret management command.
43
+ """
44
+ def __init__(self, secret_service: SecretService):
45
+ self._secret_service = secret_service
46
+
47
+ def process(self, arguments: List[str]) -> bool:
48
+
49
+ if not len(arguments) == 1:
50
+ error("Invalid arguments, expected usage: secret --retrieve --key <key>")
51
+ return False
52
+
53
+ key = arguments.pop(0)
54
+ self._secret_service.retrieve_secret_by_key(key)
55
+
56
+ return True
57
+
58
+ def chain_to(self, arguments: List[str]) -> str | None:
59
+ return None
60
+
61
+ def for_subcommand(self) -> str:
62
+ return "--retrieve --key"
63
+
64
+ class RetrieveByContextSecretCommandProcessor(SecretCommandProcessor):
65
+ """
66
+ SecretCommandProcessor implementation to process the --retrieve --context <context> secret management command.
67
+ """
68
+ def __init__(self, secret_service: SecretService):
69
+ self._secret_service = secret_service
70
+
71
+ def process(self, arguments: List[str]) -> bool:
72
+
73
+ if not len(arguments) == 1:
74
+ error("Invalid arguments, expected usage: secret --retrieve --context <context>")
75
+ return False
76
+
77
+ context = arguments.pop(0)
78
+ self._secret_service.retrieve_secrets_by_context(context)
79
+
80
+ return True
81
+
82
+ def chain_to(self, arguments: List[str]) -> str | None:
83
+ return None
84
+
85
+ def for_subcommand(self) -> str:
86
+ return "--retrieve --context"
@@ -25,3 +25,12 @@ class DominoCommand(Enum):
25
25
  DEPLOY_VERSION = DominoRequestDescriptor(HTTPMethod.PUT, "/lifecycle/{0}/deploy/{1}")
26
26
  INFO = DominoRequestDescriptor(HTTPMethod.GET, "/lifecycle/{0}/info")
27
27
  IMPORT = DominoRequestDescriptor(HTTPMethod.POST, "/deployments/import")
28
+
29
+ RETRIEVE_ALL_METADATA = DominoRequestDescriptor(HTTPMethod.GET, "/secrets")
30
+ RETRIEVE_SECRET = DominoRequestDescriptor(HTTPMethod.GET, "/secrets/{0}")
31
+ RETRIEVE_SECRET_METADATA = DominoRequestDescriptor(HTTPMethod.GET, "/secrets/{0}/metadata")
32
+ RETRIEVE_SECRETS_BY_CONTEXT = DominoRequestDescriptor(HTTPMethod.GET, "/secrets/context/{0}")
33
+ CREATE_SECRET = DominoRequestDescriptor(HTTPMethod.POST, "/secrets")
34
+ LOCK_SECRET = DominoRequestDescriptor(HTTPMethod.DELETE, "/secrets/{0}/retrieval")
35
+ UNLOCK_SECRET = DominoRequestDescriptor(HTTPMethod.PUT, "/secrets/{0}/retrieval")
36
+ DELETE_SECRET = DominoRequestDescriptor(HTTPMethod.DELETE, "/secrets/{0}")
@@ -14,3 +14,14 @@ class DominoRequest:
14
14
 
15
15
  def __repr__(self):
16
16
  return "[{0} {1}]".format(self.method.value, self.path)
17
+
18
+ def __eq__(self, other):
19
+
20
+ if other is None:
21
+ return False
22
+
23
+ return self.method == other.method \
24
+ and self.path == other.path \
25
+ and self.body == other.body \
26
+ and self.as_text == other.as_text \
27
+ and self.authenticated == other.authenticated