remotivelabs-cli 0.0.30__tar.gz → 0.0.31__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/PKG-INFO +1 -1
  2. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/filestorage.py +7 -7
  3. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/resumable_upload.py +7 -5
  4. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/pyproject.toml +1 -1
  5. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/LICENSE +0 -0
  6. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/README.md +0 -0
  7. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/__init__.py +0 -0
  8. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/brokers.py +0 -0
  9. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/export.py +0 -0
  10. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/files.py +0 -0
  11. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/lib/__about__.py +0 -0
  12. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/lib/broker.py +0 -0
  13. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/license_flows.py +0 -0
  14. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/licenses.py +0 -0
  15. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/playback.py +0 -0
  16. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/record.py +0 -0
  17. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/scripting.py +0 -0
  18. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/broker/signals.py +0 -0
  19. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/__init__.py +0 -0
  20. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/auth.py +0 -0
  21. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/auth_tokens.py +0 -0
  22. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/brokers.py +0 -0
  23. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/cloud_cli.py +0 -0
  24. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/configs.py +0 -0
  25. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/organisations.py +0 -0
  26. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/projects.py +0 -0
  27. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/recordings.py +0 -0
  28. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/recordings_playback.py +0 -0
  29. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/rest_helper.py +0 -0
  30. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/sample_recordings.py +0 -0
  31. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/service_account_tokens.py +0 -0
  32. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/cloud/service_accounts.py +0 -0
  33. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/connect/__init__.py +0 -0
  34. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/connect/connect.py +0 -0
  35. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/connect/protopie/protopie.py +0 -0
  36. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/errors.py +0 -0
  37. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/remotive.py +0 -0
  38. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/settings.py +0 -0
  39. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/tools/__init__.py +0 -0
  40. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/tools/can/__init__.py +0 -0
  41. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/tools/can/can.py +0 -0
  42. {remotivelabs_cli-0.0.30 → remotivelabs_cli-0.0.31}/cli/tools/tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotivelabs-cli
3
- Version: 0.0.30
3
+ Version: 0.0.31
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import json
3
4
  import os.path
4
5
  import sys
5
6
  from pathlib import Path
@@ -75,6 +76,7 @@ def delete_file(
75
76
  def copy_file( # noqa: C901 # type: ignore[too-many-branches] # pylint: disable=no-member
76
77
  source: str = typer.Argument(default=..., help="Remote or local path to source file"),
77
78
  dest: str = typer.Argument(default=..., help="Remote or local path to destination file"),
79
+ overwrite: bool = typer.Option(default=False, help="Overwrite existing file on RCS"),
78
80
  project: str = typer.Option(..., help="Project ID", envvar="REMOTIVE_CLOUD_PROJECT"),
79
81
  ) -> None:
80
82
  """
@@ -100,20 +102,17 @@ def copy_file( # noqa: C901 # type: ignore[too-many-branches] # pylint: disabl
100
102
  else:
101
103
  path = Path(source)
102
104
  if path.is_dir():
103
- print("is dir")
104
105
  for file_path in path.rglob("*"):
105
106
  if file_path.is_file():
106
- print(file_path)
107
- __copy_to_remote(source=source, dest=dest, project=project)
107
+ __copy_to_remote(source=source, dest=dest, project=project, overwrite=overwrite)
108
108
  sys.exit(1)
109
109
  else:
110
- __copy_to_remote(source=source, dest=dest, project=project)
110
+ __copy_to_remote(source=source, dest=dest, project=project, overwrite=overwrite)
111
111
 
112
112
 
113
- def __copy_to_remote(source: str, dest: str, project: str) -> None:
113
+ def __copy_to_remote(source: str, dest: str, project: str, overwrite: bool) -> None:
114
114
  path = Path(source)
115
115
  if path.is_dir():
116
- print("is dir")
117
116
  sys.exit(1)
118
117
 
119
118
  if not path.exists():
@@ -123,7 +122,8 @@ def __copy_to_remote(source: str, dest: str, project: str) -> None:
123
122
  rcs_path = __check_rcs_path(dest)
124
123
  if rcs_path.endswith("/"):
125
124
  rcs_path = rcs_path + filename
126
- res = Rest.handle_post(f"/api/project/{project}/files/storage{rcs_path}", return_response=True)
125
+ upload_options = {"overwrite": "always" if overwrite else "never"}
126
+ res = Rest.handle_post(f"/api/project/{project}/files/storage{rcs_path}", return_response=True, body=json.dumps(upload_options))
127
127
  if res is None:
128
128
  return
129
129
  json_res = res.json()
@@ -76,10 +76,12 @@ def upload_signed_url(signed_url: str, source_file_name: str, headers: Dict[str,
76
76
  :param source_file_name:
77
77
  :return:
78
78
  """
79
- with open(source_file_name, "rb") as f:
80
- response = requests.put(signed_url, headers=headers, timeout=60, data=f)
81
- if response.status_code not in (200, 201, 308):
82
- ErrorPrinter.print_generic_error(f"Failed to upload file: {response.status_code} - {response.text}")
83
- sys.exit(1)
79
+
80
+ with open(source_file_name, "rb") as file:
81
+ with wrap_file(file, os.stat(source_file_name).st_size, description=f"Uploading {source_file_name}...") as f:
82
+ response = requests.put(signed_url, headers=headers, timeout=60, data=f)
83
+ if response.status_code not in (200, 201, 308):
84
+ ErrorPrinter.print_generic_error(f"Failed to upload file: {response.status_code} - {response.text}")
85
+ sys.exit(1)
84
86
 
85
87
  print(f"File {source_file_name} uploaded successfully.")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "remotivelabs-cli"
3
- version = "0.0.30"
3
+ version = "0.0.31"
4
4
  description = "CLI for operating RemotiveCloud and RemotiveBroker"
5
5
  authors = ["Johan Rask <johan.rask@remotivelabs.com>"]
6
6
  readme = "README.md"