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 CHANGED
@@ -20,7 +20,7 @@
20
20
  #
21
21
  """This file is part of the peak-sdk framework.
22
22
 
23
- Copyright © 2023 Peak AI
23
+ Copyright © 2024 Peak AI
24
24
 
25
25
  Unauthorized copying of this file, via any medium is strictly prohibited.
26
26
  """
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
@@ -18,4 +18,4 @@
18
18
  # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
- __version__: str = "1.3.0"
21
+ __version__: str = "1.5.0"
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]
@@ -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.