blackant-sdk 1.0.2__tar.gz → 1.0.4__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.
- blackant_sdk-1.0.4/PKG-INFO +196 -0
- blackant_sdk-1.0.4/README.md +148 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/pyproject.toml +5 -1
- blackant_sdk-1.0.4/src/blackant/cli.py +301 -0
- blackant_sdk-1.0.4/src/blackant_sdk.egg-info/PKG-INFO +196 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant_sdk.egg-info/SOURCES.txt +2 -0
- blackant_sdk-1.0.4/src/blackant_sdk.egg-info/entry_points.txt +2 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant_sdk.egg-info/requires.txt +1 -0
- blackant_sdk-1.0.2/PKG-INFO +0 -117
- blackant_sdk-1.0.2/README.md +0 -70
- blackant_sdk-1.0.2/src/blackant_sdk.egg-info/PKG-INFO +0 -117
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/MANIFEST.in +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/_version.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/config/defaults.yaml +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/config/development.yaml +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/config/production.yaml +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/config/schema.yaml +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/Makefile +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/conf.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/index.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/api.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/auth.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/blackant.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/config.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/docker.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/http.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/patterns.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/services.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/docs/source/modules/utils.rst +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/examples/build_service_demo.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/requirements-dev.txt +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/requirements.debug.txt +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/requirements.txt +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/setup.cfg +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/setup.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/blackant_auth.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/keycloak_manager.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/request_id.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/role_assignment.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/auth/tokens.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/client.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/config/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/config/docker_config.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/config/keycloak_admin_config.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/docker/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/docker/builder.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/docker/client.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/docker/dao.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/docker/registry.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/exceptions.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/http/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/http/client.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/patterns/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/patterns/singleton.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/services/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/services/dao.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/services/registry.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/utils/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/utils/initialization.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/utils/logging.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/utils/request_id.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant/utils/store.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant_sdk.egg-info/dependency_links.txt +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/blackant_sdk.egg-info/top_level.txt +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/base.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/errors.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/impl/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/impl/my_calculation.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/impl/simple_calc.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/impl/test.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/impl/test_calc.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/calculation/loader.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/healthcheck.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/notifinations/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/notifinations/mail_sender.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/server.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/server_status.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/storage/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/storage/errors.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/storage/factory.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/storage/interface.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/storage/minio.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/dao.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/errors.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/log_adapter.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/base.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/callback.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/cmd_args.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/freetext.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/objects.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/parsers/request.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/resource.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/base.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/error.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/idle.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/ready.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/running.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/set_up.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/states/tear_down.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/src/task/task.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/conftest.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_auth_operations.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_automatic_role_assignment.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_build_service_operations.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_client_credentials_operations.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_core_methods_integration.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_docker_operations.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_full_state_machine_e2e.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_remote_docker_build.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_service_operations.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/function/test_task_communication.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/__init__.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_auth_tokens.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_calculation_loader.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_client_credentials_auth.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_docker_builder.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_docker_dao.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_http.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_http_integration.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_keycloak_manager.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_logger.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_my_calculation.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_request_id.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_role_assignment.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_service_manager_dao.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_singleton.py +0 -0
- {blackant_sdk-1.0.2 → blackant_sdk-1.0.4}/test/unit/test_store.py +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blackant-sdk
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Python SDK for Docker operations with automatic authentication through BlackAnt platform
|
|
5
|
+
Author-email: Balázs Milán <milan.balazs@uni-obuda.hu>
|
|
6
|
+
Maintainer-email: BlackAnt Development Team <dev@blackant.app>
|
|
7
|
+
License: Proprietary - Óbudai Egyetem
|
|
8
|
+
Project-URL: Homepage, https://env.blackant.app/systemdevelopers/blackant_sdk
|
|
9
|
+
Project-URL: Documentation, https://docs.blackant.app
|
|
10
|
+
Project-URL: Repository, https://env.blackant.app/systemdevelopers/blackant_sdk
|
|
11
|
+
Project-URL: Bug Tracker, https://env.blackant.app/systemdevelopers/blackant_sdk/-/issues
|
|
12
|
+
Keywords: docker,sdk,authentication,blackant,container,orchestration,swarm
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: flask>=2.3.2
|
|
24
|
+
Requires-Dist: flask-restful>=0.3.10
|
|
25
|
+
Requires-Dist: waitress>=2.1.2
|
|
26
|
+
Requires-Dist: minio>=6.0.0
|
|
27
|
+
Requires-Dist: requests>=2.31.0
|
|
28
|
+
Requires-Dist: docker>=4.4.3
|
|
29
|
+
Requires-Dist: urllib3<2.0
|
|
30
|
+
Requires-Dist: gunicorn>=21.2.0
|
|
31
|
+
Requires-Dist: colorama>=0.4.6
|
|
32
|
+
Requires-Dist: python-keycloak>=3.0.0
|
|
33
|
+
Requires-Dist: PyJWT>=2.8.0
|
|
34
|
+
Requires-Dist: click>=8.1.0
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
39
|
+
Requires-Dist: sphinx>=5.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "dev"
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: sphinx>=5.0.0; extra == "docs"
|
|
47
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
48
|
+
|
|
49
|
+
# BlackAnt SDK
|
|
50
|
+
|
|
51
|
+
Python SDK for Docker operations with automatic authentication through the BlackAnt platform.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- Automatic authentication with BlackAnt platform
|
|
56
|
+
- Build Docker images on remote daemon
|
|
57
|
+
- Push images to private registry
|
|
58
|
+
- Service management (list, status, delete)
|
|
59
|
+
- Both Python API and CLI interface
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install blackant-sdk
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
### Python API
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from blackant import BlackAntClient
|
|
73
|
+
|
|
74
|
+
# Initialize client
|
|
75
|
+
client = BlackAntClient(
|
|
76
|
+
user="your-username",
|
|
77
|
+
password="your-password",
|
|
78
|
+
base_url="https://your-blackant-instance.com"
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Authenticate
|
|
82
|
+
if client.authenticate():
|
|
83
|
+
print("Connected to BlackAnt!")
|
|
84
|
+
|
|
85
|
+
# Build and push a service
|
|
86
|
+
result = client.build_service(
|
|
87
|
+
service_name="my-calculation",
|
|
88
|
+
impl_path="./src/calculation/impl",
|
|
89
|
+
tag="v1.0.0",
|
|
90
|
+
push=True
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
print(f"Image: {result['full_image']}")
|
|
94
|
+
|
|
95
|
+
# List services
|
|
96
|
+
services = client.list_services()
|
|
97
|
+
for svc in services:
|
|
98
|
+
print(f" - {svc['name']}: {svc['status']}")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Command Line Interface (CLI)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Set credentials via environment variables
|
|
105
|
+
export BLACKANT_USER=your-username
|
|
106
|
+
export BLACKANT_PASSWORD=your-password
|
|
107
|
+
export BLACKANT_URL=https://your-blackant-instance.com
|
|
108
|
+
|
|
109
|
+
# Test connection
|
|
110
|
+
blackant login
|
|
111
|
+
|
|
112
|
+
# Build and push
|
|
113
|
+
blackant build --name my-calculation --path ./src/calculation/impl --tag v1.0.0
|
|
114
|
+
|
|
115
|
+
# List services
|
|
116
|
+
blackant list
|
|
117
|
+
|
|
118
|
+
# Get service status
|
|
119
|
+
blackant status my-calculation
|
|
120
|
+
|
|
121
|
+
# Delete service
|
|
122
|
+
blackant delete my-calculation
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Environment Variables
|
|
126
|
+
|
|
127
|
+
| Variable | Description | Default |
|
|
128
|
+
|----------|-------------|---------|
|
|
129
|
+
| `BLACKANT_USER` | Username for authentication | - |
|
|
130
|
+
| `BLACKANT_PASSWORD` | Password for authentication | - |
|
|
131
|
+
| `BLACKANT_URL` | BlackAnt platform base URL | `https://dev.blackant.app` |
|
|
132
|
+
|
|
133
|
+
## API Reference
|
|
134
|
+
|
|
135
|
+
### BlackAntClient
|
|
136
|
+
|
|
137
|
+
The main client class providing all SDK functionality.
|
|
138
|
+
|
|
139
|
+
#### Methods
|
|
140
|
+
|
|
141
|
+
| Method | Description |
|
|
142
|
+
|--------|-------------|
|
|
143
|
+
| `authenticate()` | Authenticate with BlackAnt platform |
|
|
144
|
+
| `test_connection()` | Test if connection is working |
|
|
145
|
+
| `build_service(...)` | Build Docker image and optionally push |
|
|
146
|
+
| `list_services()` | List all registered services |
|
|
147
|
+
| `get_service(name)` | Get service details |
|
|
148
|
+
| `get_service_status(name)` | Get service status |
|
|
149
|
+
| `delete_service(name)` | Delete a service |
|
|
150
|
+
|
|
151
|
+
### CLI Commands
|
|
152
|
+
|
|
153
|
+
| Command | Description |
|
|
154
|
+
|---------|-------------|
|
|
155
|
+
| `blackant login` | Test connection and authenticate |
|
|
156
|
+
| `blackant build` | Build Docker image and push to registry |
|
|
157
|
+
| `blackant list` | List all registered services |
|
|
158
|
+
| `blackant status <name>` | Get status of a service |
|
|
159
|
+
| `blackant info <name>` | Get detailed service information |
|
|
160
|
+
| `blackant delete <name>` | Delete a service |
|
|
161
|
+
|
|
162
|
+
Use `blackant <command> --help` for detailed options.
|
|
163
|
+
|
|
164
|
+
## Requirements
|
|
165
|
+
|
|
166
|
+
- Python 3.11+
|
|
167
|
+
- Access to a BlackAnt platform instance
|
|
168
|
+
- Valid BlackAnt credentials
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
Proprietary - Obuda University, John von Neumann Faculty of Informatics
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## About
|
|
177
|
+
|
|
178
|
+
<p align="center">
|
|
179
|
+
<img src="https://nik.uni-obuda.hu/wp-content/uploads/2025/10/NIK_logo_header.png" alt="NIK Logo" width="300"/>
|
|
180
|
+
</p>
|
|
181
|
+
|
|
182
|
+
This SDK is developed and maintained by the **BlackAnt Development Team** at:
|
|
183
|
+
|
|
184
|
+
**Obuda University - John von Neumann Faculty of Informatics**
|
|
185
|
+
*(Óbudai Egyetem - Neumann János Informatikai Kar)*
|
|
186
|
+
|
|
187
|
+
| | |
|
|
188
|
+
|---|---|
|
|
189
|
+
| Address | 1034 Budapest, Bécsi út 96/B, Hungary |
|
|
190
|
+
| Phone | +36 1 666 5520 |
|
|
191
|
+
| Email | titkarsag@nik.uni-obuda.hu |
|
|
192
|
+
| Web | [nik.uni-obuda.hu](https://nik.uni-obuda.hu) |
|
|
193
|
+
|
|
194
|
+
## Support
|
|
195
|
+
|
|
196
|
+
For SDK issues and questions, contact the BlackAnt Development Team at dev@blackant.app
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# BlackAnt SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for Docker operations with automatic authentication through the BlackAnt platform.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Automatic authentication with BlackAnt platform
|
|
8
|
+
- Build Docker images on remote daemon
|
|
9
|
+
- Push images to private registry
|
|
10
|
+
- Service management (list, status, delete)
|
|
11
|
+
- Both Python API and CLI interface
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install blackant-sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Python API
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from blackant import BlackAntClient
|
|
25
|
+
|
|
26
|
+
# Initialize client
|
|
27
|
+
client = BlackAntClient(
|
|
28
|
+
user="your-username",
|
|
29
|
+
password="your-password",
|
|
30
|
+
base_url="https://your-blackant-instance.com"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Authenticate
|
|
34
|
+
if client.authenticate():
|
|
35
|
+
print("Connected to BlackAnt!")
|
|
36
|
+
|
|
37
|
+
# Build and push a service
|
|
38
|
+
result = client.build_service(
|
|
39
|
+
service_name="my-calculation",
|
|
40
|
+
impl_path="./src/calculation/impl",
|
|
41
|
+
tag="v1.0.0",
|
|
42
|
+
push=True
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
print(f"Image: {result['full_image']}")
|
|
46
|
+
|
|
47
|
+
# List services
|
|
48
|
+
services = client.list_services()
|
|
49
|
+
for svc in services:
|
|
50
|
+
print(f" - {svc['name']}: {svc['status']}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Command Line Interface (CLI)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Set credentials via environment variables
|
|
57
|
+
export BLACKANT_USER=your-username
|
|
58
|
+
export BLACKANT_PASSWORD=your-password
|
|
59
|
+
export BLACKANT_URL=https://your-blackant-instance.com
|
|
60
|
+
|
|
61
|
+
# Test connection
|
|
62
|
+
blackant login
|
|
63
|
+
|
|
64
|
+
# Build and push
|
|
65
|
+
blackant build --name my-calculation --path ./src/calculation/impl --tag v1.0.0
|
|
66
|
+
|
|
67
|
+
# List services
|
|
68
|
+
blackant list
|
|
69
|
+
|
|
70
|
+
# Get service status
|
|
71
|
+
blackant status my-calculation
|
|
72
|
+
|
|
73
|
+
# Delete service
|
|
74
|
+
blackant delete my-calculation
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Environment Variables
|
|
78
|
+
|
|
79
|
+
| Variable | Description | Default |
|
|
80
|
+
|----------|-------------|---------|
|
|
81
|
+
| `BLACKANT_USER` | Username for authentication | - |
|
|
82
|
+
| `BLACKANT_PASSWORD` | Password for authentication | - |
|
|
83
|
+
| `BLACKANT_URL` | BlackAnt platform base URL | `https://dev.blackant.app` |
|
|
84
|
+
|
|
85
|
+
## API Reference
|
|
86
|
+
|
|
87
|
+
### BlackAntClient
|
|
88
|
+
|
|
89
|
+
The main client class providing all SDK functionality.
|
|
90
|
+
|
|
91
|
+
#### Methods
|
|
92
|
+
|
|
93
|
+
| Method | Description |
|
|
94
|
+
|--------|-------------|
|
|
95
|
+
| `authenticate()` | Authenticate with BlackAnt platform |
|
|
96
|
+
| `test_connection()` | Test if connection is working |
|
|
97
|
+
| `build_service(...)` | Build Docker image and optionally push |
|
|
98
|
+
| `list_services()` | List all registered services |
|
|
99
|
+
| `get_service(name)` | Get service details |
|
|
100
|
+
| `get_service_status(name)` | Get service status |
|
|
101
|
+
| `delete_service(name)` | Delete a service |
|
|
102
|
+
|
|
103
|
+
### CLI Commands
|
|
104
|
+
|
|
105
|
+
| Command | Description |
|
|
106
|
+
|---------|-------------|
|
|
107
|
+
| `blackant login` | Test connection and authenticate |
|
|
108
|
+
| `blackant build` | Build Docker image and push to registry |
|
|
109
|
+
| `blackant list` | List all registered services |
|
|
110
|
+
| `blackant status <name>` | Get status of a service |
|
|
111
|
+
| `blackant info <name>` | Get detailed service information |
|
|
112
|
+
| `blackant delete <name>` | Delete a service |
|
|
113
|
+
|
|
114
|
+
Use `blackant <command> --help` for detailed options.
|
|
115
|
+
|
|
116
|
+
## Requirements
|
|
117
|
+
|
|
118
|
+
- Python 3.11+
|
|
119
|
+
- Access to a BlackAnt platform instance
|
|
120
|
+
- Valid BlackAnt credentials
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Proprietary - Obuda University, John von Neumann Faculty of Informatics
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## About
|
|
129
|
+
|
|
130
|
+
<p align="center">
|
|
131
|
+
<img src="https://nik.uni-obuda.hu/wp-content/uploads/2025/10/NIK_logo_header.png" alt="NIK Logo" width="300"/>
|
|
132
|
+
</p>
|
|
133
|
+
|
|
134
|
+
This SDK is developed and maintained by the **BlackAnt Development Team** at:
|
|
135
|
+
|
|
136
|
+
**Obuda University - John von Neumann Faculty of Informatics**
|
|
137
|
+
*(Óbudai Egyetem - Neumann János Informatikai Kar)*
|
|
138
|
+
|
|
139
|
+
| | |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Address | 1034 Budapest, Bécsi út 96/B, Hungary |
|
|
142
|
+
| Phone | +36 1 666 5520 |
|
|
143
|
+
| Email | titkarsag@nik.uni-obuda.hu |
|
|
144
|
+
| Web | [nik.uni-obuda.hu](https://nik.uni-obuda.hu) |
|
|
145
|
+
|
|
146
|
+
## Support
|
|
147
|
+
|
|
148
|
+
For SDK issues and questions, contact the BlackAnt Development Team at dev@blackant.app
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "blackant-sdk"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.4"
|
|
8
8
|
description = "Python SDK for Docker operations with automatic authentication through BlackAnt platform"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -39,8 +39,12 @@ dependencies = [
|
|
|
39
39
|
"colorama>=0.4.6",
|
|
40
40
|
"python-keycloak>=3.0.0",
|
|
41
41
|
"PyJWT>=2.8.0",
|
|
42
|
+
"click>=8.1.0",
|
|
42
43
|
]
|
|
43
44
|
|
|
45
|
+
[project.scripts]
|
|
46
|
+
blackant = "blackant.cli:main"
|
|
47
|
+
|
|
44
48
|
[project.optional-dependencies]
|
|
45
49
|
dev = [
|
|
46
50
|
"pytest>=7.0.0",
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"""BlackAnt SDK Command Line Interface.
|
|
2
|
+
|
|
3
|
+
This module provides a CLI for the BlackAnt SDK, allowing users to
|
|
4
|
+
interact with the BlackAnt platform directly from the terminal.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
blackant login --user USER --password PASS --url URL
|
|
8
|
+
blackant build --name SERVICE_NAME --path PATH [--push]
|
|
9
|
+
blackant list
|
|
10
|
+
blackant status SERVICE_NAME
|
|
11
|
+
blackant delete SERVICE_NAME
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
import click
|
|
17
|
+
from typing import Optional
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_client(user: Optional[str] = None, password: Optional[str] = None,
|
|
21
|
+
base_url: Optional[str] = None, login_url: Optional[str] = None):
|
|
22
|
+
"""Create and authenticate a BlackAnt client.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
user: Username (or from BLACKANT_USER env var)
|
|
26
|
+
password: Password (or from BLACKANT_PASSWORD env var)
|
|
27
|
+
base_url: Base URL (or from BLACKANT_URL env var)
|
|
28
|
+
login_url: Login URL (or from BLACKANT_LOGIN_URL env var)
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
Authenticated BlackAntClient instance
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
click.ClickException: If authentication fails or credentials missing
|
|
35
|
+
"""
|
|
36
|
+
from blackant import BlackAntClient
|
|
37
|
+
|
|
38
|
+
user = user or os.getenv("BLACKANT_USER")
|
|
39
|
+
password = password or os.getenv("BLACKANT_PASSWORD")
|
|
40
|
+
base_url = base_url or os.getenv("BLACKANT_URL", "https://dev.blackant.app")
|
|
41
|
+
login_url = login_url or os.getenv("BLACKANT_LOGIN_URL", f"{base_url}/api/auth/login")
|
|
42
|
+
|
|
43
|
+
if not user or not password:
|
|
44
|
+
raise click.ClickException(
|
|
45
|
+
"Missing credentials. Provide --user and --password, "
|
|
46
|
+
"or set BLACKANT_USER and BLACKANT_PASSWORD environment variables."
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
client = BlackAntClient(
|
|
51
|
+
user=user,
|
|
52
|
+
password=password,
|
|
53
|
+
base_url=base_url,
|
|
54
|
+
login_url=login_url
|
|
55
|
+
)
|
|
56
|
+
if not client.authenticate():
|
|
57
|
+
raise click.ClickException("Authentication failed. Check your credentials.")
|
|
58
|
+
return client
|
|
59
|
+
except Exception as e:
|
|
60
|
+
raise click.ClickException(f"Failed to connect: {e}")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@click.group()
|
|
64
|
+
@click.version_option(version="1.0.4", prog_name="blackant")
|
|
65
|
+
def main():
|
|
66
|
+
"""BlackAnt SDK - Command Line Interface
|
|
67
|
+
|
|
68
|
+
Interact with the BlackAnt platform from your terminal.
|
|
69
|
+
|
|
70
|
+
\b
|
|
71
|
+
Environment variables:
|
|
72
|
+
BLACKANT_USER - Username for authentication
|
|
73
|
+
BLACKANT_PASSWORD - Password for authentication
|
|
74
|
+
BLACKANT_URL - Base URL (default: https://dev.blackant.app)
|
|
75
|
+
|
|
76
|
+
\b
|
|
77
|
+
Examples:
|
|
78
|
+
blackant login --user admin --password xxx
|
|
79
|
+
blackant build --name my-calc --path ./src/calculation/impl --push
|
|
80
|
+
blackant list
|
|
81
|
+
blackant status my-calc
|
|
82
|
+
"""
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@main.command()
|
|
87
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
88
|
+
@click.option("--password", "-p", help="BlackAnt password")
|
|
89
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
90
|
+
def login(user: Optional[str], password: Optional[str], url: Optional[str]):
|
|
91
|
+
"""Test connection and authenticate with BlackAnt.
|
|
92
|
+
|
|
93
|
+
Verifies that the provided credentials are valid and the
|
|
94
|
+
BlackAnt platform is reachable.
|
|
95
|
+
"""
|
|
96
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
97
|
+
|
|
98
|
+
if client.test_connection():
|
|
99
|
+
click.secho("Successfully connected to BlackAnt!", fg="green")
|
|
100
|
+
click.echo(f" User: {user or os.getenv('BLACKANT_USER')}")
|
|
101
|
+
click.echo(f" URL: {url or os.getenv('BLACKANT_URL', 'https://dev.blackant.app')}")
|
|
102
|
+
else:
|
|
103
|
+
raise click.ClickException("Connection test failed.")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@main.command()
|
|
107
|
+
@click.option("--name", "-n", required=True, help="Service name")
|
|
108
|
+
@click.option("--path", "-p", required=True, help="Path to implementation directory")
|
|
109
|
+
@click.option("--dockerfile", "-d", default="Dockerfile", help="Dockerfile name (default: Dockerfile)")
|
|
110
|
+
@click.option("--tag", "-t", default="latest", help="Image tag (default: latest)")
|
|
111
|
+
@click.option("--push/--no-push", default=True, help="Push to registry after build (default: yes)")
|
|
112
|
+
@click.option("--register/--no-register", default=False, help="Register service after push (default: no)")
|
|
113
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
114
|
+
@click.option("--password", help="BlackAnt password")
|
|
115
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
116
|
+
def build(name: str, path: str, dockerfile: str, tag: str, push: bool,
|
|
117
|
+
register: bool, user: Optional[str], password: Optional[str],
|
|
118
|
+
url: Optional[str]):
|
|
119
|
+
"""Build a Docker image and optionally push to registry.
|
|
120
|
+
|
|
121
|
+
\b
|
|
122
|
+
Examples:
|
|
123
|
+
blackant build --name my-calc --path ./src/calculation/impl
|
|
124
|
+
blackant build --name my-calc --path ./impl --tag v1.0.0 --push
|
|
125
|
+
blackant build --name my-calc --path ./impl --no-push
|
|
126
|
+
"""
|
|
127
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
128
|
+
|
|
129
|
+
click.echo(f"Building service '{name}' from {path}...")
|
|
130
|
+
click.echo(f" Dockerfile: {dockerfile}")
|
|
131
|
+
click.echo(f" Tag: {tag}")
|
|
132
|
+
click.echo(f" Push: {'yes' if push else 'no'}")
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
result = client.build_service(
|
|
136
|
+
service_name=name,
|
|
137
|
+
impl_path=path,
|
|
138
|
+
dockerfile_path=dockerfile,
|
|
139
|
+
tag=tag,
|
|
140
|
+
push=push,
|
|
141
|
+
register_service=register
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
if result.get("build_success"):
|
|
145
|
+
click.secho("Build successful!", fg="green")
|
|
146
|
+
click.echo(f" Image: {result.get('full_image', 'N/A')}")
|
|
147
|
+
click.echo(f" Image ID: {result.get('image_id', 'N/A')[:12]}...")
|
|
148
|
+
size_mb = result.get('size', 0) / 1024 / 1024
|
|
149
|
+
click.echo(f" Size: {size_mb:.2f} MB")
|
|
150
|
+
|
|
151
|
+
if push and result.get("pushed"):
|
|
152
|
+
click.secho("Push successful!", fg="green")
|
|
153
|
+
elif push:
|
|
154
|
+
click.secho("Push failed!", fg="red")
|
|
155
|
+
else:
|
|
156
|
+
raise click.ClickException("Build failed. Check logs for details.")
|
|
157
|
+
|
|
158
|
+
except Exception as e:
|
|
159
|
+
raise click.ClickException(f"Build error: {e}")
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@main.command("list")
|
|
163
|
+
@click.option("--namespace", "-ns", help="Filter by namespace")
|
|
164
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
165
|
+
@click.option("--password", "-p", help="BlackAnt password")
|
|
166
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
167
|
+
def list_services(namespace: Optional[str], user: Optional[str],
|
|
168
|
+
password: Optional[str], url: Optional[str]):
|
|
169
|
+
"""List all registered services.
|
|
170
|
+
|
|
171
|
+
\b
|
|
172
|
+
Examples:
|
|
173
|
+
blackant list
|
|
174
|
+
blackant list --namespace production
|
|
175
|
+
"""
|
|
176
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
services = client.list_services(namespace=namespace)
|
|
180
|
+
|
|
181
|
+
if not services:
|
|
182
|
+
click.echo("No services found.")
|
|
183
|
+
return
|
|
184
|
+
|
|
185
|
+
click.echo(f"Found {len(services)} service(s):\n")
|
|
186
|
+
|
|
187
|
+
for svc in services:
|
|
188
|
+
name = svc.get("name", "Unknown")
|
|
189
|
+
status = svc.get("status", "Unknown")
|
|
190
|
+
svc_type = svc.get("type", "Unknown")
|
|
191
|
+
|
|
192
|
+
# Color based on status
|
|
193
|
+
if status.lower() in ("running", "active"):
|
|
194
|
+
status_color = "green"
|
|
195
|
+
elif status.lower() in ("stopped", "inactive"):
|
|
196
|
+
status_color = "yellow"
|
|
197
|
+
else:
|
|
198
|
+
status_color = "white"
|
|
199
|
+
|
|
200
|
+
click.echo(f" {name}")
|
|
201
|
+
click.echo(f" Status: ", nl=False)
|
|
202
|
+
click.secho(status, fg=status_color)
|
|
203
|
+
click.echo(f" Type: {svc_type}")
|
|
204
|
+
click.echo()
|
|
205
|
+
|
|
206
|
+
except Exception as e:
|
|
207
|
+
raise click.ClickException(f"Failed to list services: {e}")
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@main.command()
|
|
211
|
+
@click.argument("name")
|
|
212
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
213
|
+
@click.option("--password", "-p", help="BlackAnt password")
|
|
214
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
215
|
+
def status(name: str, user: Optional[str], password: Optional[str],
|
|
216
|
+
url: Optional[str]):
|
|
217
|
+
"""Get status of a specific service.
|
|
218
|
+
|
|
219
|
+
\b
|
|
220
|
+
Examples:
|
|
221
|
+
blackant status my-calc
|
|
222
|
+
blackant status my-service --user admin --password xxx
|
|
223
|
+
"""
|
|
224
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
225
|
+
|
|
226
|
+
try:
|
|
227
|
+
svc_status = client.get_service_status(service_name=name)
|
|
228
|
+
|
|
229
|
+
click.echo(f"Service: {name}\n")
|
|
230
|
+
|
|
231
|
+
for key, value in svc_status.items():
|
|
232
|
+
click.echo(f" {key}: {value}")
|
|
233
|
+
|
|
234
|
+
except Exception as e:
|
|
235
|
+
raise click.ClickException(f"Failed to get status: {e}")
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@main.command()
|
|
239
|
+
@click.argument("name")
|
|
240
|
+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation")
|
|
241
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
242
|
+
@click.option("--password", "-p", help="BlackAnt password")
|
|
243
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
244
|
+
def delete(name: str, yes: bool, user: Optional[str], password: Optional[str],
|
|
245
|
+
url: Optional[str]):
|
|
246
|
+
"""Delete a service.
|
|
247
|
+
|
|
248
|
+
\b
|
|
249
|
+
Examples:
|
|
250
|
+
blackant delete my-calc
|
|
251
|
+
blackant delete my-calc --yes
|
|
252
|
+
"""
|
|
253
|
+
if not yes:
|
|
254
|
+
click.confirm(f"Are you sure you want to delete '{name}'?", abort=True)
|
|
255
|
+
|
|
256
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
257
|
+
|
|
258
|
+
try:
|
|
259
|
+
if client.delete_service(service_name=name):
|
|
260
|
+
click.secho(f"Service '{name}' deleted successfully!", fg="green")
|
|
261
|
+
else:
|
|
262
|
+
raise click.ClickException(f"Failed to delete service '{name}'.")
|
|
263
|
+
|
|
264
|
+
except Exception as e:
|
|
265
|
+
raise click.ClickException(f"Delete error: {e}")
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@main.command()
|
|
269
|
+
@click.argument("name")
|
|
270
|
+
@click.option("--user", "-u", help="BlackAnt username")
|
|
271
|
+
@click.option("--password", "-p", help="BlackAnt password")
|
|
272
|
+
@click.option("--url", help="BlackAnt base URL")
|
|
273
|
+
def info(name: str, user: Optional[str], password: Optional[str],
|
|
274
|
+
url: Optional[str]):
|
|
275
|
+
"""Get detailed information about a service.
|
|
276
|
+
|
|
277
|
+
\b
|
|
278
|
+
Examples:
|
|
279
|
+
blackant info my-calc
|
|
280
|
+
"""
|
|
281
|
+
client = get_client(user=user, password=password, base_url=url)
|
|
282
|
+
|
|
283
|
+
try:
|
|
284
|
+
service = client.get_service(service_name=name)
|
|
285
|
+
|
|
286
|
+
click.echo(f"Service: {name}\n")
|
|
287
|
+
|
|
288
|
+
for key, value in service.items():
|
|
289
|
+
if isinstance(value, dict):
|
|
290
|
+
click.echo(f" {key}:")
|
|
291
|
+
for k, v in value.items():
|
|
292
|
+
click.echo(f" {k}: {v}")
|
|
293
|
+
else:
|
|
294
|
+
click.echo(f" {key}: {value}")
|
|
295
|
+
|
|
296
|
+
except Exception as e:
|
|
297
|
+
raise click.ClickException(f"Failed to get service info: {e}")
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
if __name__ == "__main__":
|
|
301
|
+
main()
|