peak-sdk 1.3.0__py3-none-any.whl → 1.5.0__py3-none-any.whl
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.
- peak/__init__.py +1 -1
- peak/_metadata.py +43 -0
- peak/_version.py +1 -1
- peak/cli/cli.py +3 -1
- peak/cli/helpers.py +27 -0
- peak/cli/press/blocks/specs.py +0 -2
- peak/cli/resources/services.py +632 -0
- peak/cli/resources/users.py +71 -0
- peak/cli/resources/webapps.py +75 -14
- peak/cli/resources/workflows.py +0 -4
- peak/helpers.py +27 -0
- peak/output.py +9 -0
- peak/press/blocks.py +10 -15
- peak/resources/__init__.py +2 -2
- peak/resources/services.py +413 -0
- peak/resources/users.py +93 -0
- peak/resources/webapps.py +13 -7
- peak/resources/workflows.py +3 -7
- peak/sample_yaml/resources/services/create_or_update_service.yaml +24 -0
- peak/sample_yaml/resources/services/create_service.yaml +24 -0
- peak/sample_yaml/resources/services/test_service.yaml +8 -0
- peak/sample_yaml/resources/services/update_service.yaml +22 -0
- peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +0 -1
- peak/sample_yaml/resources/workflows/update_workflow.yaml +0 -1
- peak/session.py +7 -4
- peak/template.py +2 -2
- peak/validators.py +34 -2
- {peak_sdk-1.3.0.dist-info → peak_sdk-1.5.0.dist-info}/LICENSE +1 -1
- {peak_sdk-1.3.0.dist-info → peak_sdk-1.5.0.dist-info}/METADATA +6 -6
- {peak_sdk-1.3.0.dist-info → peak_sdk-1.5.0.dist-info}/RECORD +32 -24
- {peak_sdk-1.3.0.dist-info → peak_sdk-1.5.0.dist-info}/WHEEL +0 -0
- {peak_sdk-1.3.0.dist-info → peak_sdk-1.5.0.dist-info}/entry_points.txt +0 -0
peak/__init__.py
CHANGED
peak/_metadata.py
CHANGED
@@ -241,6 +241,37 @@ command_metadata: Dict[str, Any] = {
|
|
241
241
|
"subheader_key": "webappsCount",
|
242
242
|
},
|
243
243
|
},
|
244
|
+
"list_services": {
|
245
|
+
"table_params": {
|
246
|
+
"output_keys": {
|
247
|
+
"id": {
|
248
|
+
"label": "ID",
|
249
|
+
},
|
250
|
+
"name": {
|
251
|
+
"label": "Name",
|
252
|
+
},
|
253
|
+
"serviceType": {
|
254
|
+
"label": "Service Type",
|
255
|
+
},
|
256
|
+
"status": {
|
257
|
+
"label": "Status",
|
258
|
+
},
|
259
|
+
"updatedBy": {
|
260
|
+
"label": "Updated By",
|
261
|
+
},
|
262
|
+
"updatedAt": {
|
263
|
+
"label": "Updated At (UTC)",
|
264
|
+
},
|
265
|
+
"tags": {
|
266
|
+
"label": "Tags",
|
267
|
+
"parser": tag_parser,
|
268
|
+
},
|
269
|
+
},
|
270
|
+
"title": "Services",
|
271
|
+
"data_key": "services",
|
272
|
+
"subheader_key": "servicesCount",
|
273
|
+
},
|
274
|
+
},
|
244
275
|
"list_artifacts": {
|
245
276
|
"table_params": {
|
246
277
|
"output_keys": {
|
@@ -637,6 +668,18 @@ command_metadata: Dict[str, Any] = {
|
|
637
668
|
"create_or_update_webapp": {
|
638
669
|
"request_body_yaml_path": "sample_yaml/resources/webapps/create_or_update_webapp.yaml",
|
639
670
|
},
|
671
|
+
"create_service": {
|
672
|
+
"request_body_yaml_path": "sample_yaml/resources/services/create_service.yaml",
|
673
|
+
},
|
674
|
+
"update_service": {
|
675
|
+
"request_body_yaml_path": "sample_yaml/resources/services/update_service.yaml",
|
676
|
+
},
|
677
|
+
"create_or_update_service": {
|
678
|
+
"request_body_yaml_path": "sample_yaml/resources/services/create_or_update_service.yaml",
|
679
|
+
},
|
680
|
+
"test_service": {
|
681
|
+
"request_body_yaml_path": "sample_yaml/resources/services/test_service.yaml",
|
682
|
+
},
|
640
683
|
"create_app_spec": {
|
641
684
|
"request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec.yaml",
|
642
685
|
},
|
peak/_version.py
CHANGED
peak/cli/cli.py
CHANGED
@@ -25,7 +25,7 @@ import peak.config
|
|
25
25
|
import typer
|
26
26
|
from peak.cli import args, helpers
|
27
27
|
from peak.cli.press import apps, blocks, deployments, specs
|
28
|
-
from peak.cli.resources import artifacts, images, tenants, webapps, workflows
|
28
|
+
from peak.cli.resources import artifacts, images, services, tenants, users, webapps, workflows
|
29
29
|
from peak.constants import Sources
|
30
30
|
from peak.output import Writer
|
31
31
|
|
@@ -37,11 +37,13 @@ typer_app.add_typer(images.app, name="images")
|
|
37
37
|
typer_app.add_typer(artifacts.app, name="artifacts")
|
38
38
|
typer_app.add_typer(workflows.app, name="workflows")
|
39
39
|
typer_app.add_typer(webapps.app, name="webapps")
|
40
|
+
typer_app.add_typer(services.app, name="services")
|
40
41
|
typer_app.add_typer(tenants.app, name="tenants")
|
41
42
|
typer_app.add_typer(apps.app, name="apps")
|
42
43
|
typer_app.add_typer(blocks.app, name="blocks")
|
43
44
|
typer_app.add_typer(specs.app, name="specs")
|
44
45
|
typer_app.add_typer(deployments.app, name="deployments")
|
46
|
+
typer_app.add_typer(users.app, name="users")
|
45
47
|
|
46
48
|
|
47
49
|
@typer_app.callback()
|
peak/cli/helpers.py
CHANGED
@@ -189,6 +189,31 @@ def parse_build_arguments(build_arguments: List[str]) -> List[Dict[str, str]]:
|
|
189
189
|
return parsed_build_arguments
|
190
190
|
|
191
191
|
|
192
|
+
def parse_envs(env: List[str]) -> Dict[str, str]:
|
193
|
+
"""Parses envs provided via cli args to the format {arg1: value1}.
|
194
|
+
|
195
|
+
Args:
|
196
|
+
env (List[str]): List of envs provided via cli args.
|
197
|
+
|
198
|
+
Returns:
|
199
|
+
Dict[str, str]: Envs in the required format.
|
200
|
+
|
201
|
+
Raises:
|
202
|
+
BadParameterException: If a value is invalid.
|
203
|
+
"""
|
204
|
+
parsed_envs: Dict[str, str] = {}
|
205
|
+
for env_arg in env:
|
206
|
+
try:
|
207
|
+
key, value = env_arg.split("=", 1)
|
208
|
+
except ValueError as err:
|
209
|
+
raise BadParameterException(
|
210
|
+
env_arg,
|
211
|
+
message="Invalid env format. It should in the --env arg1=value1 format",
|
212
|
+
) from err
|
213
|
+
parsed_envs[key] = value
|
214
|
+
return parsed_envs
|
215
|
+
|
216
|
+
|
192
217
|
def format_logs(logs: List[Dict[str, Any]]) -> str:
|
193
218
|
"""Formats logs into a readable format.
|
194
219
|
|
@@ -223,7 +248,9 @@ def get_client(command: str) -> base_client.BaseClient:
|
|
223
248
|
"artifacts": resources.artifacts,
|
224
249
|
"images": resources.images,
|
225
250
|
"workflows": resources.workflows,
|
251
|
+
"services": resources.services,
|
226
252
|
"webapps": resources.webapps,
|
227
253
|
"tenants": resources.tenants,
|
254
|
+
"users": resources.users,
|
228
255
|
}
|
229
256
|
return command_client_map[command].get_client() # type: ignore[no-any-return]
|
peak/cli/press/blocks/specs.py
CHANGED
@@ -165,7 +165,6 @@ def create(
|
|
165
165
|
- cron (string | required: false): A valid cron expression.
|
166
166
|
webhook (boolean | required: false): Should be true if webhook type trigger is to be used.
|
167
167
|
webhookId (string | required: false): ID of the webhook.
|
168
|
-
webhookPolicy (string | required: false): Policy of the webhook to be used. Should be one of "generate" or "preserve". It is "generate" by default.
|
169
168
|
watchers (list(map) | required: false):
|
170
169
|
- events (map):
|
171
170
|
success (boolean | required: false): Whether to call event on success.
|
@@ -430,7 +429,6 @@ def create_release(
|
|
430
429
|
cron (string | required: false): A valid cron expression.
|
431
430
|
webhook (boolean | required: false): Should be true if webhook type trigger is to be used.
|
432
431
|
webhookId (string | required: false): ID of the webhook.
|
433
|
-
webhookPolicy (string | required: false): Policy of the webhook to be used. Should be one of "generate" or "preserve". It is "generate" by default.
|
434
432
|
watchers (list(map) | required: false):
|
435
433
|
- events (map):
|
436
434
|
success (boolean | required: false): Whether to call event on success.
|