domino-cli 2.0.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.
- domino_cli-2.0.0/.gitignore +7 -0
- domino_cli-2.0.0/PKG-INFO +198 -0
- domino_cli-2.0.0/README.md +180 -0
- domino_cli-2.0.0/domino_cli/__init__.py +20 -0
- domino_cli-2.0.0/domino_cli/__main__.py +4 -0
- domino_cli-2.0.0/domino_cli/core/ApplicationContext.py +144 -0
- domino_cli-2.0.0/domino_cli/core/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/cli/CLI.py +23 -0
- domino_cli-2.0.0/domino_cli/core/cli/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/client/DominoClient.py +31 -0
- domino_cli-2.0.0/domino_cli/core/client/OAuthAuthorizationClient.py +54 -0
- domino_cli-2.0.0/domino_cli/core/client/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/command/AbstractCommand.py +31 -0
- domino_cli-2.0.0/domino_cli/core/command/AbstractLifecycleCommand.py +26 -0
- domino_cli-2.0.0/domino_cli/core/command/AuthCommand.py +46 -0
- domino_cli-2.0.0/domino_cli/core/command/DeployApplicationCommand.py +36 -0
- domino_cli-2.0.0/domino_cli/core/command/ExitCommand.py +16 -0
- domino_cli-2.0.0/domino_cli/core/command/HelpCommand.py +18 -0
- domino_cli-2.0.0/domino_cli/core/command/InfoCommand.py +14 -0
- domino_cli-2.0.0/domino_cli/core/command/RestartApplicationCommand.py +14 -0
- domino_cli-2.0.0/domino_cli/core/command/StartApplicationCommand.py +14 -0
- domino_cli-2.0.0/domino_cli/core/command/StopApplicationCommand.py +14 -0
- domino_cli-2.0.0/domino_cli/core/command/WizardCommand.py +27 -0
- domino_cli-2.0.0/domino_cli/core/command/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/domain/AuthMode.py +23 -0
- domino_cli-2.0.0/domino_cli/core/domain/AuthRequest.py +18 -0
- domino_cli-2.0.0/domino_cli/core/domain/CommandDescriptor.py +17 -0
- domino_cli-2.0.0/domino_cli/core/domain/DominoCommand.py +26 -0
- domino_cli-2.0.0/domino_cli/core/domain/DominoRequest.py +15 -0
- domino_cli-2.0.0/domino_cli/core/domain/HTTPMethod.py +12 -0
- domino_cli-2.0.0/domino_cli/core/domain/OAuthConfig.py +47 -0
- domino_cli-2.0.0/domino_cli/core/domain/SessionContext.py +7 -0
- domino_cli-2.0.0/domino_cli/core/domain/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/AuthenticationService.py +75 -0
- domino_cli-2.0.0/domino_cli/core/service/CommandProcessor.py +36 -0
- domino_cli-2.0.0/domino_cli/core/service/ConfigurationWizardService.py +41 -0
- domino_cli-2.0.0/domino_cli/core/service/DominoService.py +53 -0
- domino_cli-2.0.0/domino_cli/core/service/SessionContextHolder.py +27 -0
- domino_cli-2.0.0/domino_cli/core/service/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/auth/AbstractAuthHandler.py +29 -0
- domino_cli-2.0.0/domino_cli/core/service/auth/AuthUtils.py +39 -0
- domino_cli-2.0.0/domino_cli/core/service/auth/DirectAuthHandler.py +47 -0
- domino_cli-2.0.0/domino_cli/core/service/auth/OAuthAuthHandler.py +32 -0
- domino_cli-2.0.0/domino_cli/core/service/auth/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/utility/BCryptUtil.py +15 -0
- domino_cli-2.0.0/domino_cli/core/service/utility/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/AbstractAgentConfigWizard.py +79 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/AbstractWizard.py +120 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/BinaryExecutableAgentConfigWizard.py +60 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/CoordinatorConfigWizard.py +99 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/DeploymentConfigWizard.py +117 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/DockerAgentConfigWizard.py +53 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/InstallerWizard.py +62 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/BinaryExecutablePlatformComponentInstaller.py +79 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/DockerPlatformComponentInstaller.py +85 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/DockerVersionResolver.py +24 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/GitHubReleaseVersionResolver.py +36 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/PlatformComponentInstaller.py +58 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/installer/__init__.py +18 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/BinaryExecutableAgentConfigWizardDataMapping.py +26 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/CommonAgentConfigWizardDataMapping.py +27 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/CoordinatorConfigWizardDataMapping.py +43 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/DeploymentConfigWizardDataMapping.py +47 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/DockerAgentConfigWizardDataMapping.py +20 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/InstallerWizardDataMapping.py +27 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/WizardDataMappingBaseEnum.py +68 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/mapping/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/render/WizardResultConsoleRenderer.py +19 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/render/WizardResultFileRenderer.py +35 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/render/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/BaseWizardStep.py +47 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/KeyValuePairAnswerWizardStep.py +30 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/MultiAnswerWizardStep.py +24 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/OptionSelectorWizardStep.py +59 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/WizardStep.py +80 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/step/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/AbstractWizardResultTransformer.py +109 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/BinaryExecutableAgentConfigWizardResultTransformer.py +39 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/CoordinatorConfigWizardResultTransformer.py +47 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/DeploymentConfigWizardResultTransformer.py +87 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/DockerAgentConfigWizardResultTransformer.py +39 -0
- domino_cli-2.0.0/domino_cli/core/service/wizard/transformer/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/core/util/ArrayStream.py +40 -0
- domino_cli-2.0.0/domino_cli/core/util/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/installer_config.py +34 -0
- domino_cli-2.0.0/domino_cli/resource/__init__.py +0 -0
- domino_cli-2.0.0/domino_cli/resource/help.txt +14 -0
- domino_cli-2.0.0/pyproject.toml +38 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: domino-cli
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Domino Platform CLI tool, providing utilities to install, configure and control your Domino Platform insfrastructure
|
|
5
|
+
Project-URL: Maintainer's website, https://psprog.hu
|
|
6
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Intended Audience :: System Administrators
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Requires-Dist: bcrypt==4.0.0
|
|
15
|
+
Requires-Dist: pyyaml
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Domino CLI
|
|
20
|
+
|
|
21
|
+
Domino CLI is a command line interface tool written in Python for
|
|
22
|
+
[Domino Platform deployment orchestration system](https://github.com/petersmith-hun/domino-platform).
|
|
23
|
+
Its purpose is to provide a convenient way of controlling the Domino Platform Coordinator via its REST interface. It can
|
|
24
|
+
also generate configuration files for each Domino Platform components, as well as install those.
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
* Domino CLI requires Python 3.x for execution (tested on Python 3.7, 3.8, 3.10 and 3.12).
|
|
29
|
+
* Pip (Python package installer) is required for installation.
|
|
30
|
+
* It is executable both on Windows and Linux systems.
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
The tool can be configured via the following environment variables:
|
|
35
|
+
|
|
36
|
+
| Environment variable | Mandatory? | Description |
|
|
37
|
+
|----------------------------|---------------|-----------------------------------------------------------------------------------------------|
|
|
38
|
+
| DOMINO_BASE_URL | Yes | URL of Domino instance to be controlled, e.g. http://localhost:8080/domino |
|
|
39
|
+
| DOMINO_CLI_USERNAME | No | Optional predefined username for accessing Domino |
|
|
40
|
+
| DOMINO_CLI_PASSWORD | No | Optional predefined password for accessing Domino |
|
|
41
|
+
| DOMINO_CLI_DEBUG_MODE | No | Optional debug switch. Currently its only effect is echoing the parsed command |
|
|
42
|
+
| DOMINO_DEFAULT_AUTH_MODE | No | Changes how Domino CLI acquires the access token for Domino. Defaults to direct mode (legacy) |
|
|
43
|
+
| DOMINO_OAUTH_TOKEN_URL | In OAuth mode | OAuth 2.0 compliant authorization server address, including the token request endpoint path |
|
|
44
|
+
| DOMINO_OAUTH_CLIENT_ID | In OAuth mode | OAuth 2.0 Client ID of Domino CLI |
|
|
45
|
+
| DOMINO_OAUTH_CLIENT_SECRET | In OAuth mode | OAuth 2.0 Client Secret of Domino CLI |
|
|
46
|
+
| DOMINO_OAUTH_SCOPE | In OAuth mode | OAuth 2.0 access token scope |
|
|
47
|
+
| DOMINO_OAUTH_AUDIENCE | No | OAuth 2.0 audience of Domino |
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
Domino CLI can be installed via `pip` and then it can be executed as a standalone CLI tool. In order to install,
|
|
52
|
+
execute the following command in the terminal:
|
|
53
|
+
|
|
54
|
+
* On Windows:
|
|
55
|
+
```shell
|
|
56
|
+
py -m pip install domino-cli
|
|
57
|
+
# or
|
|
58
|
+
pip install domino-cli
|
|
59
|
+
```
|
|
60
|
+
* On Linux:
|
|
61
|
+
```shell
|
|
62
|
+
python3 -m pip install domino-cli
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Execution
|
|
66
|
+
|
|
67
|
+
Domino CLI can be executed from any terminal with Python. First the `DOMINO_BASE_URL` parameter must be defined.
|
|
68
|
+
To do this, execute the following command in the terminal:
|
|
69
|
+
|
|
70
|
+
* On Windows:
|
|
71
|
+
```shell
|
|
72
|
+
set DOMINO_BASE_URL=<your_domino_instance_url>
|
|
73
|
+
```
|
|
74
|
+
* On Linux:
|
|
75
|
+
```shell
|
|
76
|
+
export DOMINO_BASE_URL=<your_domino_instance_url>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Notes:
|
|
80
|
+
* With the same approach you can set the other supported environment variables as well.
|
|
81
|
+
* You may consider setting the environment variables permanently in the supported way of your platform.
|
|
82
|
+
|
|
83
|
+
After this step, you can start Domino CLI:
|
|
84
|
+
```shell
|
|
85
|
+
domino-cli
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
After successfully starting up Domino CLI you should see its prompt (`Domino CLI >`) along with some start-up messages.
|
|
90
|
+
Now it's time to start playing around with the commands - the supported ones are the following:
|
|
91
|
+
|
|
92
|
+
### Generic commands
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
help
|
|
96
|
+
```
|
|
97
|
+
Anytime you feel unsure how to use the tool, just type this command to have the in-application help text printed.
|
|
98
|
+
This will also be printed in case you type an unsupported command or hit enter without typing any commands.
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
exit
|
|
102
|
+
```
|
|
103
|
+
This command doesn't really need any explanation, it makes the tool quit.
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
auth <--encrypt-password|--generate-token|--open-session|--set-mode <direct|oauth>>
|
|
107
|
+
```
|
|
108
|
+
Authentication command serves three different purposes based on the provided flag.
|
|
109
|
+
* `--encrypt-password`: Provides a utility to hash the provided password with BCrypt.
|
|
110
|
+
The generated hash can be used in Domino's configuration as its management access account password.
|
|
111
|
+
* `--generate-token`: Authenticates with Domino in order to generate a management access token.
|
|
112
|
+
The generated token can be used by external systems needing access to Domino.
|
|
113
|
+
* `--open-session`: Authenticates with Domino in order to generate a management access token AND
|
|
114
|
+
stores it in the tool's security context. Opening a session is always needed to access lifecycle commands.
|
|
115
|
+
Opening a session is only needed once every time you start the tool, but the token is stored only in memory,
|
|
116
|
+
so you always need to open a session after starting the tool.
|
|
117
|
+
* `--set-mode <direct|oauth>`: Changes the active authentication mode. Since CLI v1.3.0, it's possible to use an
|
|
118
|
+
external OAuth 2.0 Authorization Server to acquire access token for Domino. Please note, that both Domino and
|
|
119
|
+
Domino CLI must be registered clients on the specified authorization server; as well as Domino must be configured
|
|
120
|
+
to accept the token issued by the configured authorization server. The default auth mode is the legacy one,
|
|
121
|
+
called "direct". Please make sure to specify the required OAuth parameters before changing the auth mode to "oauth".
|
|
122
|
+
Also, this feature is only supported in Domino v1.5.0 and above.
|
|
123
|
+
|
|
124
|
+
Opening a session and generating a token require full authentication, therefore the tool asks for your configured
|
|
125
|
+
(on Domino side) management account username and password (only in direct auth mode). You can speed up the process by
|
|
126
|
+
predefining the credentials as environment variables (see [Configuration](#configuration) section). Please be warned
|
|
127
|
+
that by setting the password as an environment variable you cause a potential security vulnerability to your system.
|
|
128
|
+
Keeping this in mind please handle this option with caution!
|
|
129
|
+
|
|
130
|
+
### Lifecycle-management commands
|
|
131
|
+
|
|
132
|
+
The commands below work only in case the proper application registrations have already been made in Domino.
|
|
133
|
+
The `app` parameter of the commands always refer to an application's registered identifier.
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
deploy <app> <latest|version>
|
|
137
|
+
```
|
|
138
|
+
Instructs Domino to deploy the specified version of the given application. The application and its selected version
|
|
139
|
+
must be already uploaded to the target server via Domino. Specify the keyword `latest` to let Domino decide which
|
|
140
|
+
version to be deployed, or provide an existing version number of the application.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
start <app>
|
|
144
|
+
```
|
|
145
|
+
Instructs Domino to start the currently deployed version of the application.
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
stop <app>
|
|
149
|
+
```
|
|
150
|
+
Instructs Domino to stop the currently running instance of the application.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
restart <app>
|
|
154
|
+
```
|
|
155
|
+
Instructs Domino to restart the currently running instance of the application.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
info <app>
|
|
159
|
+
```
|
|
160
|
+
Instructs Domino to query the application's info endpoint and returns the results.
|
|
161
|
+
|
|
162
|
+
### Configuration wizards
|
|
163
|
+
|
|
164
|
+
Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
|
|
165
|
+
Currently one configuration wizard is supported by the tool, but the list of wizards will be extended soon.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
wizard deployment
|
|
169
|
+
```
|
|
170
|
+
Starts wizard that helps to create a Domino application deployment configuration. Usage notes:
|
|
171
|
+
* Fixed choice steps are indicated by displaying the choices with a number in square brackets at the beginning
|
|
172
|
+
of the line. Type the desired number and hit enter to select your choice.
|
|
173
|
+
* Some steps may expect multiple responses. Hit enter after each of your answers. To finalize the step hit enter
|
|
174
|
+
on an empty line.
|
|
175
|
+
* Resulted configuration can be either displayed on console or written to file. If you chose to show the result
|
|
176
|
+
on console, simply copy the displayed config into your existing Domino deployment config file. If you want to
|
|
177
|
+
write the results to file, you need to define the file path when prompted. Having an already existing deployment
|
|
178
|
+
configuration file will cause the tool to merge the newly created config with the existing file.
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
wizard coordinator
|
|
182
|
+
```
|
|
183
|
+
Starts wizard that helps to create a Domino Platform Coordinator configuration.
|
|
184
|
+
```
|
|
185
|
+
wizard docker-agent
|
|
186
|
+
```
|
|
187
|
+
Starts wizard that helps to create a Domino Platform Docker Agent configuration.
|
|
188
|
+
```
|
|
189
|
+
wizard bin-exec-agent
|
|
190
|
+
```
|
|
191
|
+
Starts wizard that helps to create a Domino Platform Binary Executable Agent configuration.
|
|
192
|
+
```
|
|
193
|
+
wizard installer
|
|
194
|
+
```
|
|
195
|
+
Starts wizard that helps to install the currently available Domino Platform components (Domino Coordinator, Domino
|
|
196
|
+
Docker Agent, and Domino Binary Executable Agent). The first two are installed as Docker containers, while the last
|
|
197
|
+
one is installed as a Systemd service. Please note, that because of this, Domino Binary Executable Agent installer
|
|
198
|
+
supports Linux OS only (tested on Ubuntu).
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Domino CLI
|
|
2
|
+
|
|
3
|
+
Domino CLI is a command line interface tool written in Python for
|
|
4
|
+
[Domino Platform deployment orchestration system](https://github.com/petersmith-hun/domino-platform).
|
|
5
|
+
Its purpose is to provide a convenient way of controlling the Domino Platform Coordinator via its REST interface. It can
|
|
6
|
+
also generate configuration files for each Domino Platform components, as well as install those.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
* Domino CLI requires Python 3.x for execution (tested on Python 3.7, 3.8, 3.10 and 3.12).
|
|
11
|
+
* Pip (Python package installer) is required for installation.
|
|
12
|
+
* It is executable both on Windows and Linux systems.
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
The tool can be configured via the following environment variables:
|
|
17
|
+
|
|
18
|
+
| Environment variable | Mandatory? | Description |
|
|
19
|
+
|----------------------------|---------------|-----------------------------------------------------------------------------------------------|
|
|
20
|
+
| DOMINO_BASE_URL | Yes | URL of Domino instance to be controlled, e.g. http://localhost:8080/domino |
|
|
21
|
+
| DOMINO_CLI_USERNAME | No | Optional predefined username for accessing Domino |
|
|
22
|
+
| DOMINO_CLI_PASSWORD | No | Optional predefined password for accessing Domino |
|
|
23
|
+
| DOMINO_CLI_DEBUG_MODE | No | Optional debug switch. Currently its only effect is echoing the parsed command |
|
|
24
|
+
| DOMINO_DEFAULT_AUTH_MODE | No | Changes how Domino CLI acquires the access token for Domino. Defaults to direct mode (legacy) |
|
|
25
|
+
| DOMINO_OAUTH_TOKEN_URL | In OAuth mode | OAuth 2.0 compliant authorization server address, including the token request endpoint path |
|
|
26
|
+
| DOMINO_OAUTH_CLIENT_ID | In OAuth mode | OAuth 2.0 Client ID of Domino CLI |
|
|
27
|
+
| DOMINO_OAUTH_CLIENT_SECRET | In OAuth mode | OAuth 2.0 Client Secret of Domino CLI |
|
|
28
|
+
| DOMINO_OAUTH_SCOPE | In OAuth mode | OAuth 2.0 access token scope |
|
|
29
|
+
| DOMINO_OAUTH_AUDIENCE | No | OAuth 2.0 audience of Domino |
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Domino CLI can be installed via `pip` and then it can be executed as a standalone CLI tool. In order to install,
|
|
34
|
+
execute the following command in the terminal:
|
|
35
|
+
|
|
36
|
+
* On Windows:
|
|
37
|
+
```shell
|
|
38
|
+
py -m pip install domino-cli
|
|
39
|
+
# or
|
|
40
|
+
pip install domino-cli
|
|
41
|
+
```
|
|
42
|
+
* On Linux:
|
|
43
|
+
```shell
|
|
44
|
+
python3 -m pip install domino-cli
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Execution
|
|
48
|
+
|
|
49
|
+
Domino CLI can be executed from any terminal with Python. First the `DOMINO_BASE_URL` parameter must be defined.
|
|
50
|
+
To do this, execute the following command in the terminal:
|
|
51
|
+
|
|
52
|
+
* On Windows:
|
|
53
|
+
```shell
|
|
54
|
+
set DOMINO_BASE_URL=<your_domino_instance_url>
|
|
55
|
+
```
|
|
56
|
+
* On Linux:
|
|
57
|
+
```shell
|
|
58
|
+
export DOMINO_BASE_URL=<your_domino_instance_url>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Notes:
|
|
62
|
+
* With the same approach you can set the other supported environment variables as well.
|
|
63
|
+
* You may consider setting the environment variables permanently in the supported way of your platform.
|
|
64
|
+
|
|
65
|
+
After this step, you can start Domino CLI:
|
|
66
|
+
```shell
|
|
67
|
+
domino-cli
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
After successfully starting up Domino CLI you should see its prompt (`Domino CLI >`) along with some start-up messages.
|
|
72
|
+
Now it's time to start playing around with the commands - the supported ones are the following:
|
|
73
|
+
|
|
74
|
+
### Generic commands
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
help
|
|
78
|
+
```
|
|
79
|
+
Anytime you feel unsure how to use the tool, just type this command to have the in-application help text printed.
|
|
80
|
+
This will also be printed in case you type an unsupported command or hit enter without typing any commands.
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
exit
|
|
84
|
+
```
|
|
85
|
+
This command doesn't really need any explanation, it makes the tool quit.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
auth <--encrypt-password|--generate-token|--open-session|--set-mode <direct|oauth>>
|
|
89
|
+
```
|
|
90
|
+
Authentication command serves three different purposes based on the provided flag.
|
|
91
|
+
* `--encrypt-password`: Provides a utility to hash the provided password with BCrypt.
|
|
92
|
+
The generated hash can be used in Domino's configuration as its management access account password.
|
|
93
|
+
* `--generate-token`: Authenticates with Domino in order to generate a management access token.
|
|
94
|
+
The generated token can be used by external systems needing access to Domino.
|
|
95
|
+
* `--open-session`: Authenticates with Domino in order to generate a management access token AND
|
|
96
|
+
stores it in the tool's security context. Opening a session is always needed to access lifecycle commands.
|
|
97
|
+
Opening a session is only needed once every time you start the tool, but the token is stored only in memory,
|
|
98
|
+
so you always need to open a session after starting the tool.
|
|
99
|
+
* `--set-mode <direct|oauth>`: Changes the active authentication mode. Since CLI v1.3.0, it's possible to use an
|
|
100
|
+
external OAuth 2.0 Authorization Server to acquire access token for Domino. Please note, that both Domino and
|
|
101
|
+
Domino CLI must be registered clients on the specified authorization server; as well as Domino must be configured
|
|
102
|
+
to accept the token issued by the configured authorization server. The default auth mode is the legacy one,
|
|
103
|
+
called "direct". Please make sure to specify the required OAuth parameters before changing the auth mode to "oauth".
|
|
104
|
+
Also, this feature is only supported in Domino v1.5.0 and above.
|
|
105
|
+
|
|
106
|
+
Opening a session and generating a token require full authentication, therefore the tool asks for your configured
|
|
107
|
+
(on Domino side) management account username and password (only in direct auth mode). You can speed up the process by
|
|
108
|
+
predefining the credentials as environment variables (see [Configuration](#configuration) section). Please be warned
|
|
109
|
+
that by setting the password as an environment variable you cause a potential security vulnerability to your system.
|
|
110
|
+
Keeping this in mind please handle this option with caution!
|
|
111
|
+
|
|
112
|
+
### Lifecycle-management commands
|
|
113
|
+
|
|
114
|
+
The commands below work only in case the proper application registrations have already been made in Domino.
|
|
115
|
+
The `app` parameter of the commands always refer to an application's registered identifier.
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
deploy <app> <latest|version>
|
|
119
|
+
```
|
|
120
|
+
Instructs Domino to deploy the specified version of the given application. The application and its selected version
|
|
121
|
+
must be already uploaded to the target server via Domino. Specify the keyword `latest` to let Domino decide which
|
|
122
|
+
version to be deployed, or provide an existing version number of the application.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
start <app>
|
|
126
|
+
```
|
|
127
|
+
Instructs Domino to start the currently deployed version of the application.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
stop <app>
|
|
131
|
+
```
|
|
132
|
+
Instructs Domino to stop the currently running instance of the application.
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
restart <app>
|
|
136
|
+
```
|
|
137
|
+
Instructs Domino to restart the currently running instance of the application.
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
info <app>
|
|
141
|
+
```
|
|
142
|
+
Instructs Domino to query the application's info endpoint and returns the results.
|
|
143
|
+
|
|
144
|
+
### Configuration wizards
|
|
145
|
+
|
|
146
|
+
Domino CLI also provides configuration wizards which help to properly create Domino configuration files.
|
|
147
|
+
Currently one configuration wizard is supported by the tool, but the list of wizards will be extended soon.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
wizard deployment
|
|
151
|
+
```
|
|
152
|
+
Starts wizard that helps to create a Domino application deployment configuration. Usage notes:
|
|
153
|
+
* Fixed choice steps are indicated by displaying the choices with a number in square brackets at the beginning
|
|
154
|
+
of the line. Type the desired number and hit enter to select your choice.
|
|
155
|
+
* Some steps may expect multiple responses. Hit enter after each of your answers. To finalize the step hit enter
|
|
156
|
+
on an empty line.
|
|
157
|
+
* Resulted configuration can be either displayed on console or written to file. If you chose to show the result
|
|
158
|
+
on console, simply copy the displayed config into your existing Domino deployment config file. If you want to
|
|
159
|
+
write the results to file, you need to define the file path when prompted. Having an already existing deployment
|
|
160
|
+
configuration file will cause the tool to merge the newly created config with the existing file.
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
wizard coordinator
|
|
164
|
+
```
|
|
165
|
+
Starts wizard that helps to create a Domino Platform Coordinator configuration.
|
|
166
|
+
```
|
|
167
|
+
wizard docker-agent
|
|
168
|
+
```
|
|
169
|
+
Starts wizard that helps to create a Domino Platform Docker Agent configuration.
|
|
170
|
+
```
|
|
171
|
+
wizard bin-exec-agent
|
|
172
|
+
```
|
|
173
|
+
Starts wizard that helps to create a Domino Platform Binary Executable Agent configuration.
|
|
174
|
+
```
|
|
175
|
+
wizard installer
|
|
176
|
+
```
|
|
177
|
+
Starts wizard that helps to install the currently available Domino Platform components (Domino Coordinator, Domino
|
|
178
|
+
Docker Agent, and Domino Binary Executable Agent). The first two are installed as Docker containers, while the last
|
|
179
|
+
one is installed as a Systemd service. Please note, that because of this, Domino Binary Executable Agent installer
|
|
180
|
+
supports Linux OS only (tested on Ubuntu).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
domino_cli.py :: Main entry point for Domino CLI application.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
__version__ = "2.0.0"
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
from domino_cli.core.ApplicationContext import ApplicationContext
|
|
10
|
+
|
|
11
|
+
|
|
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
|
+
def main() -> None:
|
|
19
|
+
_set_work_dir()
|
|
20
|
+
ApplicationContext.init_cli(__version__).run_loop()
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from domino_cli.core.cli.CLI import CLI
|
|
4
|
+
from domino_cli.core.client.DominoClient import DominoClient
|
|
5
|
+
from domino_cli.core.client.OAuthAuthorizationClient import OAuthAuthorizationClient
|
|
6
|
+
from domino_cli.core.command.AuthCommand import AuthCommand
|
|
7
|
+
from domino_cli.core.command.DeployApplicationCommand import DeployApplicationCommand
|
|
8
|
+
from domino_cli.core.command.ExitCommand import ExitCommand
|
|
9
|
+
from domino_cli.core.command.HelpCommand import HelpCommand
|
|
10
|
+
from domino_cli.core.command.InfoCommand import InfoCommand
|
|
11
|
+
from domino_cli.core.command.RestartApplicationCommand import RestartApplicationCommand
|
|
12
|
+
from domino_cli.core.command.StartApplicationCommand import StartApplicationCommand
|
|
13
|
+
from domino_cli.core.command.StopApplicationCommand import StopApplicationCommand
|
|
14
|
+
from domino_cli.core.command.WizardCommand import WizardCommand
|
|
15
|
+
from domino_cli.core.domain.AuthMode import AuthMode
|
|
16
|
+
from domino_cli.core.domain.OAuthConfig import OAuthConfig
|
|
17
|
+
from domino_cli.core.service.AuthenticationService import AuthenticationService
|
|
18
|
+
from domino_cli.core.service.CommandProcessor import CommandProcessor
|
|
19
|
+
from domino_cli.core.service.ConfigurationWizardService import ConfigurationWizardService
|
|
20
|
+
from domino_cli.core.service.DominoService import DominoService
|
|
21
|
+
from domino_cli.core.service.SessionContextHolder import SessionContextHolder
|
|
22
|
+
from domino_cli.core.service.auth.DirectAuthHandler import DirectAuthHandler
|
|
23
|
+
from domino_cli.core.service.auth.OAuthAuthHandler import OAuthAuthHandler
|
|
24
|
+
from domino_cli.core.service.wizard.BinaryExecutableAgentConfigWizard import BinaryExecutableAgentConfigWizard
|
|
25
|
+
from domino_cli.core.service.wizard.CoordinatorConfigWizard import CoordinatorConfigWizard
|
|
26
|
+
from domino_cli.core.service.wizard.DeploymentConfigWizard import DeploymentConfigWizard
|
|
27
|
+
from domino_cli.core.service.wizard.DockerAgentConfigWizard import DockerAgentConfigWizard
|
|
28
|
+
from domino_cli.core.service.wizard.InstallerWizard import InstallerWizard
|
|
29
|
+
from domino_cli.core.service.wizard.installer.BinaryExecutablePlatformComponentInstaller import \
|
|
30
|
+
BinaryExecutablePlatformComponentInstaller
|
|
31
|
+
from domino_cli.core.service.wizard.installer.DockerPlatformComponentInstaller import DockerPlatformComponentInstaller
|
|
32
|
+
from domino_cli.core.service.wizard.installer.DockerVersionResolver import DockerVersionResolver
|
|
33
|
+
from domino_cli.core.service.wizard.installer.GitHubReleaseVersionResolver import GitHubReleaseVersionResolver
|
|
34
|
+
from domino_cli.core.service.wizard.render.WizardResultConsoleRenderer import WizardResultConsoleRenderer
|
|
35
|
+
from domino_cli.core.service.wizard.render.WizardResultFileRenderer import WizardResultFileRenderer
|
|
36
|
+
from domino_cli.core.service.wizard.transformer.BinaryExecutableAgentConfigWizardResultTransformer import \
|
|
37
|
+
BinaryExecutableAgentConfigWizardResultTransformer
|
|
38
|
+
from domino_cli.core.service.wizard.transformer.CoordinatorConfigWizardResultTransformer import \
|
|
39
|
+
CoordinatorConfigWizardResultTransformer
|
|
40
|
+
from domino_cli.core.service.wizard.transformer.DeploymentConfigWizardResultTransformer import \
|
|
41
|
+
DeploymentConfigWizardResultTransformer
|
|
42
|
+
from domino_cli.core.service.wizard.transformer.DockerAgentConfigWizardResultTransformer import \
|
|
43
|
+
DockerAgentConfigWizardResultTransformer
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ApplicationContext:
|
|
47
|
+
"""
|
|
48
|
+
Simple IoC container for Domino CLI.
|
|
49
|
+
"""
|
|
50
|
+
@staticmethod
|
|
51
|
+
def init_cli(version: str) -> CLI:
|
|
52
|
+
|
|
53
|
+
print("Initializing Domino CLI...")
|
|
54
|
+
|
|
55
|
+
# configuration properties
|
|
56
|
+
_domino_base_url = ApplicationContext._assert_config_value("DOMINO_BASE_URL")
|
|
57
|
+
_default_auth_mode = AuthMode.by_value(os.getenv("DOMINO_DEFAULT_AUTH_MODE", AuthMode.DIRECT.value))
|
|
58
|
+
_oauth_config = OAuthConfig()
|
|
59
|
+
|
|
60
|
+
# wizards
|
|
61
|
+
_wizard_result_console_renderer = WizardResultConsoleRenderer()
|
|
62
|
+
_wizard_result_file_renderer = WizardResultFileRenderer()
|
|
63
|
+
_deployment_config_wizard_result_transformer = DeploymentConfigWizardResultTransformer()
|
|
64
|
+
_coordinator_config_wizard_result_transformer = CoordinatorConfigWizardResultTransformer()
|
|
65
|
+
_docker_agent_config_wizard_result_transformer = DockerAgentConfigWizardResultTransformer()
|
|
66
|
+
_bin_exec_agent_config_wizard_result_transformer = BinaryExecutableAgentConfigWizardResultTransformer()
|
|
67
|
+
_deployment_config_wizard = DeploymentConfigWizard(_deployment_config_wizard_result_transformer,
|
|
68
|
+
_wizard_result_console_renderer,
|
|
69
|
+
_wizard_result_file_renderer)
|
|
70
|
+
_coordinator_config_wizard = CoordinatorConfigWizard(_coordinator_config_wizard_result_transformer,
|
|
71
|
+
_wizard_result_console_renderer,
|
|
72
|
+
_wizard_result_file_renderer)
|
|
73
|
+
_docker_agent_config_wizard = DockerAgentConfigWizard(_docker_agent_config_wizard_result_transformer,
|
|
74
|
+
_wizard_result_console_renderer,
|
|
75
|
+
_wizard_result_file_renderer)
|
|
76
|
+
_bin_exec_agent_config_wizard = BinaryExecutableAgentConfigWizard(_bin_exec_agent_config_wizard_result_transformer,
|
|
77
|
+
_wizard_result_console_renderer,
|
|
78
|
+
_wizard_result_file_renderer)
|
|
79
|
+
|
|
80
|
+
# installer
|
|
81
|
+
_docker_version_resolver = DockerVersionResolver()
|
|
82
|
+
_github_release_version_resolver = GitHubReleaseVersionResolver()
|
|
83
|
+
_docker_platform_component_installer = DockerPlatformComponentInstaller(_docker_version_resolver)
|
|
84
|
+
_bin_exec_platform_component_installer = BinaryExecutablePlatformComponentInstaller(_github_release_version_resolver)
|
|
85
|
+
_installer_wizard = InstallerWizard(_docker_platform_component_installer, _bin_exec_platform_component_installer)
|
|
86
|
+
|
|
87
|
+
# common components
|
|
88
|
+
_session_context_holder = SessionContextHolder()
|
|
89
|
+
_domino_client = DominoClient(_domino_base_url, _session_context_holder)
|
|
90
|
+
_oauth_authorization_client = OAuthAuthorizationClient(_oauth_config)
|
|
91
|
+
_domino_service = DominoService(_domino_client)
|
|
92
|
+
_direct_auth_handler = DirectAuthHandler(_domino_client)
|
|
93
|
+
_oauth_auth_handler = OAuthAuthHandler(_oauth_config, _oauth_authorization_client)
|
|
94
|
+
_auth_service = AuthenticationService(_default_auth_mode, _session_context_holder, [
|
|
95
|
+
_direct_auth_handler,
|
|
96
|
+
_oauth_auth_handler
|
|
97
|
+
])
|
|
98
|
+
_config_wizard_service = ConfigurationWizardService([
|
|
99
|
+
_deployment_config_wizard,
|
|
100
|
+
_coordinator_config_wizard,
|
|
101
|
+
_docker_agent_config_wizard,
|
|
102
|
+
_bin_exec_agent_config_wizard,
|
|
103
|
+
_installer_wizard
|
|
104
|
+
])
|
|
105
|
+
|
|
106
|
+
# commands
|
|
107
|
+
_command_exit = ExitCommand()
|
|
108
|
+
_command_help = HelpCommand()
|
|
109
|
+
_command_start_app = StartApplicationCommand(_domino_service)
|
|
110
|
+
_command_stop_app = StopApplicationCommand(_domino_service)
|
|
111
|
+
_command_restart_app = RestartApplicationCommand(_domino_service)
|
|
112
|
+
_command_deploy_app = DeployApplicationCommand(_domino_service)
|
|
113
|
+
_command_auth = AuthCommand(_auth_service)
|
|
114
|
+
_command_wizard = WizardCommand(_config_wizard_service)
|
|
115
|
+
_command_info = InfoCommand(_domino_service)
|
|
116
|
+
|
|
117
|
+
# command processor
|
|
118
|
+
_command_processor = CommandProcessor(_command_help, [
|
|
119
|
+
_command_help,
|
|
120
|
+
_command_exit,
|
|
121
|
+
_command_auth,
|
|
122
|
+
_command_deploy_app,
|
|
123
|
+
_command_restart_app,
|
|
124
|
+
_command_start_app,
|
|
125
|
+
_command_stop_app,
|
|
126
|
+
_command_wizard,
|
|
127
|
+
_command_info
|
|
128
|
+
])
|
|
129
|
+
|
|
130
|
+
_cli = CLI(_command_processor)
|
|
131
|
+
|
|
132
|
+
print(f"Domino CLI v{version} initialized.")
|
|
133
|
+
print("-" * 30)
|
|
134
|
+
|
|
135
|
+
return _cli
|
|
136
|
+
|
|
137
|
+
@staticmethod
|
|
138
|
+
def _assert_config_value(config_parameter: str) -> str:
|
|
139
|
+
|
|
140
|
+
config_value = os.getenv(config_parameter)
|
|
141
|
+
if config_value is None:
|
|
142
|
+
raise Exception("Configuration parameter {0} is not specified".format(config_parameter))
|
|
143
|
+
|
|
144
|
+
return config_value
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from domino_cli.core.domain.CommandDescriptor import CommandDescriptor
|
|
2
|
+
from domino_cli.core.service.CommandProcessor import CommandProcessor
|
|
3
|
+
|
|
4
|
+
_PROMPT = "\nDomino CLI > "
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CLI:
|
|
8
|
+
"""
|
|
9
|
+
Command line interface (CLI) executor.
|
|
10
|
+
"""
|
|
11
|
+
def __init__(self, command_processor: CommandProcessor):
|
|
12
|
+
self._command_processor = command_processor
|
|
13
|
+
|
|
14
|
+
def run_loop(self) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Runs CLI command execution loop until an exit command terminates it.
|
|
17
|
+
"""
|
|
18
|
+
while True:
|
|
19
|
+
command = CommandDescriptor(input(_PROMPT))
|
|
20
|
+
continue_loop = self._command_processor.execute_command(command)
|
|
21
|
+
|
|
22
|
+
if not continue_loop:
|
|
23
|
+
break
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
from requests import Response
|
|
5
|
+
|
|
6
|
+
from domino_cli.core.domain.DominoRequest import DominoRequest
|
|
7
|
+
from domino_cli.core.service.SessionContextHolder import SessionContextHolder
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DominoClient:
|
|
11
|
+
"""
|
|
12
|
+
HTTP client implementation for sending REST request to Domino.
|
|
13
|
+
"""
|
|
14
|
+
def __init__(self, domino_base_url: str, session_context_holder: SessionContextHolder):
|
|
15
|
+
self._domino_base_url = domino_base_url
|
|
16
|
+
self._session_context_holder = session_context_holder
|
|
17
|
+
|
|
18
|
+
print("Domino CLI is configured to communicate with Domino on {0}".format(domino_base_url))
|
|
19
|
+
|
|
20
|
+
def send_command(self, domino_request: DominoRequest) -> Response:
|
|
21
|
+
"""
|
|
22
|
+
Prepares and sends a REST request to Domino based on the given DominoRequest object.
|
|
23
|
+
|
|
24
|
+
:param domino_request: DominoRequest object specifying request parameters
|
|
25
|
+
:return: Response object
|
|
26
|
+
"""
|
|
27
|
+
resolved_path = urllib.parse.urljoin(self._domino_base_url, domino_request.path)
|
|
28
|
+
json_body = domino_request.body
|
|
29
|
+
auth = self._session_context_holder.get_bearer_auth() if domino_request.authenticated else None
|
|
30
|
+
|
|
31
|
+
return requests.request(domino_request.method.value, resolved_path, json=json_body, headers=auth)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
from requests import Response
|
|
5
|
+
|
|
6
|
+
from domino_cli.core.domain.HTTPMethod import HTTPMethod
|
|
7
|
+
from domino_cli.core.domain.OAuthConfig import OAuthConfig
|
|
8
|
+
|
|
9
|
+
_ENCODING = "UTF-8"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class OAuthAuthorizationClient:
|
|
13
|
+
"""
|
|
14
|
+
HTTP client implementation for sending requests to the configured OAuth Authorization Server.
|
|
15
|
+
"""
|
|
16
|
+
def __init__(self, oauth_config: OAuthConfig):
|
|
17
|
+
self._oauth_config = oauth_config
|
|
18
|
+
|
|
19
|
+
def request_authorization(self) -> Response:
|
|
20
|
+
"""
|
|
21
|
+
Requests an access token from the configured OAuth Authorization Server.
|
|
22
|
+
Request is sent as Client Credentials Grant Flow token request, including the client ID and the scope,
|
|
23
|
+
as well as the basic authorization header.
|
|
24
|
+
|
|
25
|
+
:return: the response object
|
|
26
|
+
"""
|
|
27
|
+
return requests.request(str(HTTPMethod.POST.value),
|
|
28
|
+
self._prepare_token_url(),
|
|
29
|
+
data=self._prepare_token_request_form(),
|
|
30
|
+
headers=self._prepare_token_request_headers())
|
|
31
|
+
|
|
32
|
+
def _prepare_token_url(self) -> str:
|
|
33
|
+
|
|
34
|
+
return self._oauth_config.token_url \
|
|
35
|
+
if self._oauth_config.audience is None \
|
|
36
|
+
else f"{self._oauth_config.token_url}?audience={self._oauth_config.audience}"
|
|
37
|
+
|
|
38
|
+
def _prepare_token_request_form(self) -> dict[str, str]:
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
"grant_type": "client_credentials",
|
|
42
|
+
"client_id": self._oauth_config.client_id,
|
|
43
|
+
"scope": self._oauth_config.scope
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
def _prepare_token_request_headers(self) -> dict[str, str]:
|
|
47
|
+
|
|
48
|
+
credentials: str = f"{self._oauth_config.client_id}:{self._oauth_config.client_secret}"
|
|
49
|
+
base64_encoded_credentials: str = base64.b64encode(bytes(credentials, _ENCODING)).decode(_ENCODING)
|
|
50
|
+
auth_header_value: str = f"Basic {base64_encoded_credentials}"
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
"Authorization": auth_header_value
|
|
54
|
+
}
|