remotivelabs-cli 0.1.1__tar.gz → 0.2.0a1__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.
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/PKG-INFO +1 -1
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/errors.py +1 -1
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/remotive.py +16 -7
- remotivelabs_cli-0.2.0a1/cli/topology/cmd.py +98 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/pyproject.toml +1 -1
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/LICENSE +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/README.md +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/.DS_Store +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/api/cloud/tokens.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/brokers.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/export.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/files.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/lib/__about__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/lib/broker.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/license_flows.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/licenses.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/playback.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/record.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/scripting.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/broker/signals.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/auth/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/auth/cmd.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/auth/login.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/auth_tokens.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/brokers.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/cloud_cli.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/configs.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/organisations.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/projects.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/recordings.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/recordings_playback.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/resumable_upload.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/sample_recordings.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/service_account_tokens.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/service_accounts.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/storage/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/storage/cmd.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/storage/copy.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/storage/uri_or_path.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/cloud/uri.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/connect/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/connect/connect.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/connect/protopie/protopie.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/config_file.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/core.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/migrate_all_token_files.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/migrate_token_file.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/settings/token_file.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/tools/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/tools/can/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/tools/can/can.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/tools/tools.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/typer/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/typer/typer_utils.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/utils/__init__.py +0 -0
- {remotivelabs_cli-0.1.1 → remotivelabs_cli-0.2.0a1}/cli/utils/rest_helper.py +0 -0
@@ -9,14 +9,14 @@ from rich.console import Console
|
|
9
9
|
from trogon import Trogon # type: ignore
|
10
10
|
from typer.main import get_group
|
11
11
|
|
12
|
+
from cli.broker.brokers import app as broker_app
|
13
|
+
from cli.cloud.cloud_cli import app as cloud_app
|
14
|
+
from cli.connect.connect import app as connect_app
|
15
|
+
from cli.settings import settings
|
12
16
|
from cli.settings.migrate_all_token_files import migrate_any_legacy_tokens
|
13
|
-
|
14
|
-
from .
|
15
|
-
from .
|
16
|
-
from .connect.connect import app as connect_app
|
17
|
-
from .settings import settings
|
18
|
-
from .tools.tools import app as tools_app
|
19
|
-
from .typer import typer_utils
|
17
|
+
from cli.tools.tools import app as tools_app
|
18
|
+
from cli.topology.cmd import app as topology_app
|
19
|
+
from cli.typer import typer_utils
|
20
20
|
|
21
21
|
err_console = Console(stderr=True)
|
22
22
|
|
@@ -90,5 +90,14 @@ app.add_typer(
|
|
90
90
|
name="cloud",
|
91
91
|
help="Manage resources in RemotiveCloud",
|
92
92
|
)
|
93
|
+
app.add_typer(
|
94
|
+
topology_app,
|
95
|
+
name="topology",
|
96
|
+
help="""
|
97
|
+
RemotiveTopology actions
|
98
|
+
|
99
|
+
Read more at https://docs.remotivelabs.com/docs/remotive-topology
|
100
|
+
""",
|
101
|
+
)
|
93
102
|
app.add_typer(connect_app, name="connect", help="Integrations with other systems")
|
94
103
|
app.add_typer(tools_app, name="tools")
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import dataclasses
|
2
|
+
import datetime
|
3
|
+
from typing import Any
|
4
|
+
|
5
|
+
import typer
|
6
|
+
from rich.console import Console
|
7
|
+
|
8
|
+
from cli.errors import ErrorPrinter
|
9
|
+
from cli.settings import TokenNotFoundError, settings
|
10
|
+
from cli.typer import typer_utils
|
11
|
+
from cli.utils.rest_helper import RestHelper
|
12
|
+
|
13
|
+
HELP = """
|
14
|
+
RemotiveTopology commands
|
15
|
+
"""
|
16
|
+
console = Console()
|
17
|
+
app = typer_utils.create_typer(help=HELP)
|
18
|
+
|
19
|
+
|
20
|
+
@dataclasses.dataclass
|
21
|
+
class Subscription:
|
22
|
+
type: str
|
23
|
+
display_name: str
|
24
|
+
feature: str
|
25
|
+
start_date: str
|
26
|
+
end_date: str
|
27
|
+
|
28
|
+
|
29
|
+
def _print_current_subscription(subscription_info: dict[str, Any]) -> None:
|
30
|
+
subscription_type = subscription_info["subscriptionType"]
|
31
|
+
|
32
|
+
if subscription_type == "trial":
|
33
|
+
expires = datetime.datetime.fromisoformat(subscription_info["endDate"])
|
34
|
+
if expires < datetime.datetime.now():
|
35
|
+
console.print(f"Topology trial already ended, expired {subscription_info['endDate']}, please contact support@remotivelabs.com")
|
36
|
+
else:
|
37
|
+
console.print(f"Topology trial already started, expires {subscription_info['endDate']}")
|
38
|
+
# A paid subscription might not have an endDate
|
39
|
+
elif subscription_type == "paid":
|
40
|
+
if "endDate" in subscription_type:
|
41
|
+
expires = datetime.datetime.fromisoformat(subscription_info["endDate"])
|
42
|
+
else:
|
43
|
+
expires = None
|
44
|
+
|
45
|
+
if expires is not None and expires < datetime.datetime.now():
|
46
|
+
console.print(f"Topology subscription has ended, expired {subscription_info['endDate']}")
|
47
|
+
else:
|
48
|
+
console.print(f"Topology subscription already exists, expires {expires if expires is not None else 'Never'}")
|
49
|
+
|
50
|
+
else:
|
51
|
+
ErrorPrinter.print_generic_error("Unexpected exception, please contact support@remotivelabs.com")
|
52
|
+
raise typer.Exit(1)
|
53
|
+
|
54
|
+
|
55
|
+
@app.command("start-trial")
|
56
|
+
def start_trial(
|
57
|
+
organization: str = typer.Option(None, help="Organization to start trial for", envvar="REMOTIVE_CLOUD_ORGANIZATION"),
|
58
|
+
) -> None:
|
59
|
+
"""
|
60
|
+
Allows you ta start a 30 day trial subscription for running RemotiveTopology, you can read more at https://docs.remotivelabs.com/docs/remotive-topology.
|
61
|
+
|
62
|
+
"""
|
63
|
+
RestHelper.use_progress("Checking access tokens...", transient=True)
|
64
|
+
try:
|
65
|
+
_ = settings.get_active_token_file()
|
66
|
+
except TokenNotFoundError:
|
67
|
+
if len(settings.list_personal_token_files()) == 0:
|
68
|
+
console.print(
|
69
|
+
"You must first sign in to RemotiveCloud, please use [bold]remotive cloud auth login[/bold] to sign-in"
|
70
|
+
"This requires a RemotiveCloud account, if you do not have an account you can sign-up at https://cloud.remotivelabs.com"
|
71
|
+
)
|
72
|
+
else:
|
73
|
+
console.print(
|
74
|
+
"You have not active account, please run [bold]remotive cloud auth activate[/bold] to choose an account"
|
75
|
+
"or [bold]remotive cloud auth login[/bold] to sign-in"
|
76
|
+
)
|
77
|
+
return
|
78
|
+
|
79
|
+
has_access = RestHelper.has_access("/api/whoami")
|
80
|
+
if not has_access:
|
81
|
+
ErrorPrinter.print_generic_message("Your current active credentials are not valid")
|
82
|
+
raise typer.Exit(1)
|
83
|
+
|
84
|
+
if organization is None and settings.get_cli_config().get_active_default_organisation() is None:
|
85
|
+
ErrorPrinter.print_hint("You have not specified any organization and no default organization is set")
|
86
|
+
raise typer.Exit(1)
|
87
|
+
|
88
|
+
sub = RestHelper.handle_get(f"/api/bu/{organization}/features/topology", return_response=True, allow_status_codes=[404, 403])
|
89
|
+
if sub.status_code == 404:
|
90
|
+
created = RestHelper.handle_post(f"/api/bu/{organization}/features/topology", return_response=True)
|
91
|
+
console.print(f"Topology trial started, expires {created.json()['endDate']}")
|
92
|
+
elif sub.status_code == 403:
|
93
|
+
ErrorPrinter.print_generic_error(f"You are not allowed to start-trial topology in organization {organization}")
|
94
|
+
raise typer.Exit(1)
|
95
|
+
else:
|
96
|
+
subscription_info = sub.json()
|
97
|
+
_print_current_subscription(subscription_info)
|
98
|
+
return
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|