nextmv 0.39.0.dev1__py3-none-any.whl → 1.0.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.
- nextmv/__about__.py +1 -1
- nextmv/__entrypoint__.py +1 -2
- nextmv/__init__.py +2 -4
- nextmv/cli/CONTRIBUTING.md +583 -0
- nextmv/cli/cloud/__init__.py +49 -0
- nextmv/cli/cloud/acceptance/__init__.py +27 -0
- nextmv/cli/cloud/acceptance/create.py +391 -0
- nextmv/cli/cloud/acceptance/delete.py +64 -0
- nextmv/cli/cloud/acceptance/get.py +103 -0
- nextmv/cli/cloud/acceptance/list.py +62 -0
- nextmv/cli/cloud/acceptance/update.py +95 -0
- nextmv/cli/cloud/account/__init__.py +28 -0
- nextmv/cli/cloud/account/create.py +83 -0
- nextmv/cli/cloud/account/delete.py +59 -0
- nextmv/cli/cloud/account/get.py +66 -0
- nextmv/cli/cloud/account/update.py +70 -0
- nextmv/cli/cloud/app/__init__.py +35 -0
- nextmv/cli/cloud/app/create.py +140 -0
- nextmv/cli/cloud/app/delete.py +57 -0
- nextmv/cli/cloud/app/exists.py +44 -0
- nextmv/cli/cloud/app/get.py +66 -0
- nextmv/cli/cloud/app/list.py +61 -0
- nextmv/cli/cloud/app/push.py +432 -0
- nextmv/cli/cloud/app/update.py +124 -0
- nextmv/cli/cloud/batch/__init__.py +29 -0
- nextmv/cli/cloud/batch/create.py +452 -0
- nextmv/cli/cloud/batch/delete.py +64 -0
- nextmv/cli/cloud/batch/get.py +104 -0
- nextmv/cli/cloud/batch/list.py +63 -0
- nextmv/cli/cloud/batch/metadata.py +66 -0
- nextmv/cli/cloud/batch/update.py +95 -0
- nextmv/cli/cloud/data/__init__.py +26 -0
- nextmv/cli/cloud/data/upload.py +162 -0
- nextmv/cli/cloud/ensemble/__init__.py +33 -0
- nextmv/cli/cloud/ensemble/create.py +413 -0
- nextmv/cli/cloud/ensemble/delete.py +63 -0
- nextmv/cli/cloud/ensemble/get.py +65 -0
- nextmv/cli/cloud/ensemble/list.py +63 -0
- nextmv/cli/cloud/ensemble/update.py +103 -0
- nextmv/cli/cloud/input_set/__init__.py +32 -0
- nextmv/cli/cloud/input_set/create.py +168 -0
- nextmv/cli/cloud/input_set/delete.py +64 -0
- nextmv/cli/cloud/input_set/get.py +63 -0
- nextmv/cli/cloud/input_set/list.py +63 -0
- nextmv/cli/cloud/input_set/update.py +123 -0
- nextmv/cli/cloud/instance/__init__.py +35 -0
- nextmv/cli/cloud/instance/create.py +289 -0
- nextmv/cli/cloud/instance/delete.py +61 -0
- nextmv/cli/cloud/instance/exists.py +39 -0
- nextmv/cli/cloud/instance/get.py +62 -0
- nextmv/cli/cloud/instance/list.py +60 -0
- nextmv/cli/cloud/instance/update.py +216 -0
- nextmv/cli/cloud/managed_input/__init__.py +31 -0
- nextmv/cli/cloud/managed_input/create.py +144 -0
- nextmv/cli/cloud/managed_input/delete.py +64 -0
- nextmv/cli/cloud/managed_input/get.py +63 -0
- nextmv/cli/cloud/managed_input/list.py +60 -0
- nextmv/cli/cloud/managed_input/update.py +97 -0
- nextmv/cli/cloud/run/__init__.py +37 -0
- nextmv/cli/cloud/run/cancel.py +37 -0
- nextmv/cli/cloud/run/create.py +524 -0
- nextmv/cli/cloud/run/get.py +199 -0
- nextmv/cli/cloud/run/input.py +86 -0
- nextmv/cli/cloud/run/list.py +80 -0
- nextmv/cli/cloud/run/logs.py +166 -0
- nextmv/cli/cloud/run/metadata.py +67 -0
- nextmv/cli/cloud/run/track.py +500 -0
- nextmv/cli/cloud/scenario/__init__.py +29 -0
- nextmv/cli/cloud/scenario/create.py +451 -0
- nextmv/cli/cloud/scenario/delete.py +61 -0
- nextmv/cli/cloud/scenario/get.py +102 -0
- nextmv/cli/cloud/scenario/list.py +63 -0
- nextmv/cli/cloud/scenario/metadata.py +67 -0
- nextmv/cli/cloud/scenario/update.py +93 -0
- nextmv/cli/cloud/secrets/__init__.py +33 -0
- nextmv/cli/cloud/secrets/create.py +206 -0
- nextmv/cli/cloud/secrets/delete.py +63 -0
- nextmv/cli/cloud/secrets/get.py +66 -0
- nextmv/cli/cloud/secrets/list.py +60 -0
- nextmv/cli/cloud/secrets/update.py +144 -0
- nextmv/cli/cloud/shadow/__init__.py +33 -0
- nextmv/cli/cloud/shadow/create.py +184 -0
- nextmv/cli/cloud/shadow/delete.py +64 -0
- nextmv/cli/cloud/shadow/get.py +61 -0
- nextmv/cli/cloud/shadow/list.py +63 -0
- nextmv/cli/cloud/shadow/metadata.py +66 -0
- nextmv/cli/cloud/shadow/start.py +43 -0
- nextmv/cli/cloud/shadow/stop.py +53 -0
- nextmv/cli/cloud/shadow/update.py +96 -0
- nextmv/cli/cloud/switchback/__init__.py +33 -0
- nextmv/cli/cloud/switchback/create.py +151 -0
- nextmv/cli/cloud/switchback/delete.py +64 -0
- nextmv/cli/cloud/switchback/get.py +62 -0
- nextmv/cli/cloud/switchback/list.py +63 -0
- nextmv/cli/cloud/switchback/metadata.py +68 -0
- nextmv/cli/cloud/switchback/start.py +43 -0
- nextmv/cli/cloud/switchback/stop.py +53 -0
- nextmv/cli/cloud/switchback/update.py +96 -0
- nextmv/cli/cloud/upload/__init__.py +22 -0
- nextmv/cli/cloud/upload/create.py +39 -0
- nextmv/cli/cloud/version/__init__.py +33 -0
- nextmv/cli/cloud/version/create.py +96 -0
- nextmv/cli/cloud/version/delete.py +61 -0
- nextmv/cli/cloud/version/exists.py +39 -0
- nextmv/cli/cloud/version/get.py +62 -0
- nextmv/cli/cloud/version/list.py +60 -0
- nextmv/cli/cloud/version/update.py +92 -0
- nextmv/cli/community/__init__.py +24 -0
- nextmv/cli/community/clone.py +86 -0
- nextmv/cli/community/list.py +200 -0
- nextmv/cli/configuration/__init__.py +23 -0
- nextmv/cli/configuration/config.py +228 -0
- nextmv/cli/configuration/create.py +94 -0
- nextmv/cli/configuration/delete.py +67 -0
- nextmv/cli/configuration/list.py +77 -0
- nextmv/cli/confirm.py +34 -0
- nextmv/cli/main.py +161 -3
- nextmv/cli/message.py +170 -0
- nextmv/cli/options.py +220 -0
- nextmv/cli/version.py +22 -2
- nextmv/cloud/__init__.py +17 -38
- nextmv/cloud/acceptance_test.py +20 -83
- nextmv/cloud/account.py +269 -30
- nextmv/cloud/application/__init__.py +898 -0
- nextmv/cloud/application/_acceptance.py +424 -0
- nextmv/cloud/application/_batch_scenario.py +845 -0
- nextmv/cloud/application/_ensemble.py +251 -0
- nextmv/cloud/application/_input_set.py +263 -0
- nextmv/cloud/application/_instance.py +289 -0
- nextmv/cloud/application/_managed_input.py +227 -0
- nextmv/cloud/application/_run.py +1393 -0
- nextmv/cloud/application/_secrets.py +294 -0
- nextmv/cloud/application/_shadow.py +320 -0
- nextmv/cloud/application/_switchback.py +332 -0
- nextmv/cloud/application/_utils.py +54 -0
- nextmv/cloud/application/_version.py +304 -0
- nextmv/cloud/batch_experiment.py +6 -2
- nextmv/cloud/community.py +446 -0
- nextmv/cloud/instance.py +11 -1
- nextmv/cloud/integration.py +8 -5
- nextmv/cloud/package.py +50 -9
- nextmv/cloud/shadow.py +254 -0
- nextmv/cloud/switchback.py +228 -0
- nextmv/deprecated.py +5 -3
- nextmv/input.py +20 -88
- nextmv/local/application.py +3 -15
- nextmv/local/runner.py +1 -1
- nextmv/model.py +50 -11
- nextmv/options.py +11 -256
- nextmv/output.py +0 -62
- nextmv/polling.py +54 -16
- nextmv/run.py +84 -37
- nextmv/status.py +1 -51
- {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/METADATA +37 -11
- nextmv-1.0.0.dist-info/RECORD +185 -0
- nextmv-1.0.0.dist-info/entry_points.txt +2 -0
- nextmv/cloud/application.py +0 -4204
- nextmv-0.39.0.dev1.dist-info/RECORD +0 -55
- nextmv-0.39.0.dev1.dist-info/entry_points.txt +0 -2
- {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/WHEEL +0 -0
- {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud acceptance update command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from nextmv.cli.configuration.config import build_app
|
|
11
|
+
from nextmv.cli.message import in_progress, print_json, success
|
|
12
|
+
from nextmv.cli.options import AcceptanceTestIDOption, AppIDOption, ProfileOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def update(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
acceptance_test_id: AcceptanceTestIDOption,
|
|
22
|
+
description: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--description",
|
|
26
|
+
"-d",
|
|
27
|
+
help="Updated description of the acceptance test.",
|
|
28
|
+
metavar="DESCRIPTION",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
name: Annotated[
|
|
32
|
+
str | None,
|
|
33
|
+
typer.Option(
|
|
34
|
+
"--name",
|
|
35
|
+
"-n",
|
|
36
|
+
help="Updated name of the acceptance test.",
|
|
37
|
+
metavar="NAME",
|
|
38
|
+
),
|
|
39
|
+
] = None,
|
|
40
|
+
output: Annotated[
|
|
41
|
+
str | None,
|
|
42
|
+
typer.Option(
|
|
43
|
+
"--output",
|
|
44
|
+
"-o",
|
|
45
|
+
help="Saves the updated acceptance test information to this location.",
|
|
46
|
+
metavar="OUTPUT_PATH",
|
|
47
|
+
),
|
|
48
|
+
] = None,
|
|
49
|
+
profile: ProfileOption = None,
|
|
50
|
+
) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Update a Nextmv Cloud acceptance test.
|
|
53
|
+
|
|
54
|
+
Update the name and/or description of an acceptance test. Any fields not
|
|
55
|
+
specified will remain unchanged.
|
|
56
|
+
|
|
57
|
+
[bold][underline]Examples[/underline][/bold]
|
|
58
|
+
|
|
59
|
+
- Update the name of an acceptance test.
|
|
60
|
+
$ [dim]nextmv cloud acceptance update --app-id hare-app \\
|
|
61
|
+
--acceptance-test-id test-123 --name "Updated Test Name"[/dim]
|
|
62
|
+
|
|
63
|
+
- Update the description of an acceptance test.
|
|
64
|
+
$ [dim]nextmv cloud acceptance update --app-id hare-app \\
|
|
65
|
+
--acceptance-test-id test-123 --description "Updated description"[/dim]
|
|
66
|
+
|
|
67
|
+
- Update both name and description and save the result.
|
|
68
|
+
$ [dim]nextmv cloud acceptance update --app-id hare-app \\
|
|
69
|
+
--acceptance-test-id test-123 --name "New Name" \\
|
|
70
|
+
--description "New description" --output updated-test.json[/dim]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
74
|
+
|
|
75
|
+
in_progress(msg="Updating acceptance test...")
|
|
76
|
+
acceptance_test = cloud_app.update_acceptance_test(
|
|
77
|
+
acceptance_test_id=acceptance_test_id,
|
|
78
|
+
name=name,
|
|
79
|
+
description=description,
|
|
80
|
+
)
|
|
81
|
+
success(
|
|
82
|
+
f"Acceptance test [magenta]{acceptance_test_id}[/magenta] updated successfully "
|
|
83
|
+
f"in application [magenta]{app_id}[/magenta]."
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
acceptance_test_dict = acceptance_test.to_dict()
|
|
87
|
+
|
|
88
|
+
if output is not None and output != "":
|
|
89
|
+
with open(output, "w") as f:
|
|
90
|
+
json.dump(acceptance_test_dict, f, indent=2)
|
|
91
|
+
|
|
92
|
+
success(msg=f"Updated acceptance test information saved to [magenta]{output}[/magenta].")
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
print_json(acceptance_test_dict)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud account command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.cloud.account.create import app as create_app
|
|
8
|
+
from nextmv.cli.cloud.account.delete import app as delete_app
|
|
9
|
+
from nextmv.cli.cloud.account.get import app as get_app
|
|
10
|
+
from nextmv.cli.cloud.account.update import app as update_app
|
|
11
|
+
|
|
12
|
+
# Set up subcommand application.
|
|
13
|
+
app = typer.Typer()
|
|
14
|
+
app.add_typer(create_app)
|
|
15
|
+
app.add_typer(delete_app)
|
|
16
|
+
app.add_typer(get_app)
|
|
17
|
+
app.add_typer(update_app)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@app.callback()
|
|
21
|
+
def callback() -> None:
|
|
22
|
+
"""
|
|
23
|
+
Manage SSO for your Nextmv Cloud account (organization).
|
|
24
|
+
|
|
25
|
+
Please contact [link=https://www.nextmv.io/contact][bold]Nextmv support[/bold][/link]
|
|
26
|
+
for assistance configuring SSO for your organization.
|
|
27
|
+
"""
|
|
28
|
+
pass
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud account create command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from nextmv.cli.configuration.config import build_client
|
|
10
|
+
from nextmv.cli.message import in_progress, print_json
|
|
11
|
+
from nextmv.cli.options import ProfileOption
|
|
12
|
+
from nextmv.cloud.account import Account
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def create(
|
|
20
|
+
admins: Annotated[
|
|
21
|
+
list[str],
|
|
22
|
+
typer.Option(
|
|
23
|
+
"--admins",
|
|
24
|
+
"-a",
|
|
25
|
+
help="Email addresses of the administrators for the account. "
|
|
26
|
+
"Pass multiple emails by repeating the flag, or separating with commas.",
|
|
27
|
+
metavar="ADMINS",
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
name: Annotated[
|
|
31
|
+
str,
|
|
32
|
+
typer.Option(
|
|
33
|
+
"--name",
|
|
34
|
+
"-n",
|
|
35
|
+
help="A name for the account.",
|
|
36
|
+
metavar="NAME",
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
profile: ProfileOption = None,
|
|
40
|
+
) -> None:
|
|
41
|
+
"""
|
|
42
|
+
Create a new Nextmv Cloud account in your organization.
|
|
43
|
+
|
|
44
|
+
To create managed accounts, SSO must be configured for your organization.
|
|
45
|
+
Please contact [link=https://www.nextmv.io/contact][bold]Nextmv support[/bold][/link] for assistance.
|
|
46
|
+
|
|
47
|
+
At least one administrator email address must be provided. Multiple
|
|
48
|
+
administrators can be specified by repeating the --admins flag or by
|
|
49
|
+
separating email addresses with commas.
|
|
50
|
+
|
|
51
|
+
[bold][underline]Examples[/underline][/bold]
|
|
52
|
+
|
|
53
|
+
- Create an account named [magenta]Bunny Logistics[/magenta] with a single administrator.
|
|
54
|
+
$ [dim]nextmv cloud account create --name "Bunny Logistics" \\
|
|
55
|
+
--admins peter.rabbit@carrotexpress.com[/dim]
|
|
56
|
+
|
|
57
|
+
- Create an account named [magenta]Hare Delivery Co[/magenta] with multiple administrators.
|
|
58
|
+
$ [dim]nextmv cloud account create --name "Hare Delivery Co" \\
|
|
59
|
+
--admins bugs@acme.com --admins roger@toontown.com[/dim]
|
|
60
|
+
|
|
61
|
+
- Create an account using the profile named [magenta]hare[/magenta].
|
|
62
|
+
$ [dim]nextmv cloud account create --name "Cottontail Couriers" \\
|
|
63
|
+
--admins fluffy@hopmail.com --profile hare[/dim]
|
|
64
|
+
|
|
65
|
+
- Create an account with comma-separated administrators.
|
|
66
|
+
$ [dim]nextmv cloud account create --name "Whiskers Warehouse" \\
|
|
67
|
+
--admins "thumper@forestmail.com,flopsy@warren.io"[/dim]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
cloud_client = build_client(profile)
|
|
71
|
+
in_progress(msg="Creating account...")
|
|
72
|
+
|
|
73
|
+
admin_list = []
|
|
74
|
+
for admin in admins:
|
|
75
|
+
# It is possible to pass multiple emails separated by commas. The
|
|
76
|
+
# default way though is to use the flag multiple times to specify
|
|
77
|
+
# different options.
|
|
78
|
+
sub_admins = admin.split(",")
|
|
79
|
+
for sub_admin in sub_admins:
|
|
80
|
+
admin_list.append(sub_admin.strip())
|
|
81
|
+
|
|
82
|
+
account = Account.new(client=cloud_client, name=name, admins=admin_list)
|
|
83
|
+
print_json(account.to_dict())
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud account delete command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from nextmv.cli.configuration.config import build_account
|
|
10
|
+
from nextmv.cli.confirm import get_confirmation
|
|
11
|
+
from nextmv.cli.message import info, success
|
|
12
|
+
from nextmv.cli.options import AccountIDOption, ProfileOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def delete(
|
|
20
|
+
account_id: AccountIDOption,
|
|
21
|
+
yes: Annotated[
|
|
22
|
+
bool,
|
|
23
|
+
typer.Option(
|
|
24
|
+
"--yes",
|
|
25
|
+
"-y",
|
|
26
|
+
help="Agree to deletion confirmation prompt. Useful for non-interactive sessions.",
|
|
27
|
+
),
|
|
28
|
+
] = False,
|
|
29
|
+
profile: ProfileOption = None,
|
|
30
|
+
) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Deletes an account within your SSO-enabled organization.
|
|
33
|
+
|
|
34
|
+
You must have the [magenta]administrator[/magenta] role on that account in order to delete it.
|
|
35
|
+
|
|
36
|
+
This action is permanent and cannot be undone. Use the --yes
|
|
37
|
+
flag to skip the confirmation prompt.
|
|
38
|
+
|
|
39
|
+
[bold][underline]Examples[/underline][/bold]
|
|
40
|
+
|
|
41
|
+
- Delete the account with the ID [magenta]bunnies-account[/magenta].
|
|
42
|
+
$ [dim]nextmv cloud account delete --account-id bunnies-account[/dim]
|
|
43
|
+
|
|
44
|
+
- Delete the account without confirmation prompt.
|
|
45
|
+
$ [dim]nextmv cloud account delete --account-id bunnies-account --yes[/dim]
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
if not yes:
|
|
49
|
+
confirm = get_confirmation(
|
|
50
|
+
f"Are you sure you want to delete account [magenta]{account_id}[/magenta]? This action cannot be undone.",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if not confirm:
|
|
54
|
+
info(f"Account [magenta]{account_id}[/magenta] will not be deleted.")
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
cloud_account = build_account(account_id=account_id, profile=profile)
|
|
58
|
+
cloud_account.delete()
|
|
59
|
+
success(f"Account [magenta]{account_id}[/magenta] has been deleted.")
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud account get command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from nextmv.cli.configuration.config import build_client
|
|
11
|
+
from nextmv.cli.message import in_progress, print_json, success
|
|
12
|
+
from nextmv.cli.options import AccountIDOption, ProfileOption
|
|
13
|
+
from nextmv.cloud.account import Account
|
|
14
|
+
|
|
15
|
+
# Set up subcommand application.
|
|
16
|
+
app = typer.Typer()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.command()
|
|
20
|
+
def get(
|
|
21
|
+
account_id: AccountIDOption,
|
|
22
|
+
output: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--output",
|
|
26
|
+
"-o",
|
|
27
|
+
help="Saves the account information to this location.",
|
|
28
|
+
metavar="OUTPUT_PATH",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
profile: ProfileOption = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Get the information of a Nextmv Cloud account.
|
|
35
|
+
|
|
36
|
+
This command is useful to get the attributes of an existing Nextmv Cloud
|
|
37
|
+
account by its ID.
|
|
38
|
+
|
|
39
|
+
[bold][underline]Examples[/underline][/bold]
|
|
40
|
+
|
|
41
|
+
- Get the account with the ID [magenta]bunny-logistics[/magenta].
|
|
42
|
+
$ [dim]nextmv cloud account get --account-id bunny-logistics[/dim]
|
|
43
|
+
|
|
44
|
+
- Get the account with the ID [magenta]cottontail-couriers[/magenta] and save the information to an
|
|
45
|
+
[magenta]account.json[/magenta] file.
|
|
46
|
+
$ [dim]nextmv cloud account get --account-id cottontail-couriers --output account.json[/dim]
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
client = build_client(profile)
|
|
50
|
+
in_progress(msg="Getting account...")
|
|
51
|
+
|
|
52
|
+
cloud_account = Account.get(
|
|
53
|
+
client=client,
|
|
54
|
+
account_id=account_id,
|
|
55
|
+
)
|
|
56
|
+
cloud_account_dict = cloud_account.to_dict()
|
|
57
|
+
|
|
58
|
+
if output is not None and output != "":
|
|
59
|
+
with open(output, "w") as f:
|
|
60
|
+
json.dump(cloud_account_dict, f, indent=2)
|
|
61
|
+
|
|
62
|
+
success(msg=f"Account information saved to [magenta]{output}[/magenta].")
|
|
63
|
+
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
print_json(cloud_account_dict)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud account update command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from nextmv.cli.configuration.config import build_account
|
|
11
|
+
from nextmv.cli.message import print_json, success
|
|
12
|
+
from nextmv.cli.options import AccountIDOption, ProfileOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def update(
|
|
20
|
+
account_id: AccountIDOption,
|
|
21
|
+
name: Annotated[
|
|
22
|
+
str,
|
|
23
|
+
typer.Option(
|
|
24
|
+
"--name",
|
|
25
|
+
"-n",
|
|
26
|
+
help="A new name for the account.",
|
|
27
|
+
metavar="NAME",
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
output: Annotated[
|
|
31
|
+
str | None,
|
|
32
|
+
typer.Option(
|
|
33
|
+
"--output",
|
|
34
|
+
"-o",
|
|
35
|
+
help="Saves the updated account information to this location.",
|
|
36
|
+
metavar="OUTPUT_PATH",
|
|
37
|
+
),
|
|
38
|
+
] = None,
|
|
39
|
+
profile: ProfileOption = None,
|
|
40
|
+
) -> None:
|
|
41
|
+
"""
|
|
42
|
+
Updates information of a Nextmv Cloud account.
|
|
43
|
+
|
|
44
|
+
This command allows you to update the name of an existing account.
|
|
45
|
+
|
|
46
|
+
[bold][underline]Examples[/underline][/bold]
|
|
47
|
+
|
|
48
|
+
- Update the account named [magenta]hare-delivery[/magenta] to [magenta]Hare Delivery Co[/magenta].
|
|
49
|
+
$ [dim]nextmv cloud account update --account-id hare-delivery \\
|
|
50
|
+
--name "Hare Delivery Co"[/dim]
|
|
51
|
+
|
|
52
|
+
- Update an account and save the updated information to an [magenta]updated_account.json[/magenta] file.
|
|
53
|
+
$ [dim]nextmv cloud account update --account-id cottontail-couriers \\
|
|
54
|
+
--name "Cottontail Express" --output updated_account.json[/dim]
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
cloud_account = build_account(account_id=account_id, profile=profile)
|
|
58
|
+
updated_account = cloud_account.update(name=name)
|
|
59
|
+
success(f"Account [magenta]{account_id}[/magenta] updated successfully.")
|
|
60
|
+
updated_account_dict = updated_account.to_dict()
|
|
61
|
+
|
|
62
|
+
if output is not None and output != "":
|
|
63
|
+
with open(output, "w") as f:
|
|
64
|
+
json.dump(updated_account_dict, f, indent=2)
|
|
65
|
+
|
|
66
|
+
success(msg=f"Updated account information saved to [magenta]{output}[/magenta].")
|
|
67
|
+
|
|
68
|
+
return
|
|
69
|
+
|
|
70
|
+
print_json(updated_account_dict)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud app command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.cloud.app.create import app as create_app
|
|
8
|
+
from nextmv.cli.cloud.app.delete import app as delete_app
|
|
9
|
+
from nextmv.cli.cloud.app.exists import app as exists_app
|
|
10
|
+
from nextmv.cli.cloud.app.get import app as get_app
|
|
11
|
+
from nextmv.cli.cloud.app.list import app as list_app
|
|
12
|
+
from nextmv.cli.cloud.app.push import app as push_app
|
|
13
|
+
from nextmv.cli.cloud.app.update import app as update_app
|
|
14
|
+
|
|
15
|
+
# Set up subcommand application.
|
|
16
|
+
app = typer.Typer()
|
|
17
|
+
app.add_typer(create_app)
|
|
18
|
+
app.add_typer(delete_app)
|
|
19
|
+
app.add_typer(exists_app)
|
|
20
|
+
app.add_typer(get_app)
|
|
21
|
+
app.add_typer(list_app)
|
|
22
|
+
app.add_typer(push_app)
|
|
23
|
+
app.add_typer(update_app)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.callback()
|
|
27
|
+
def callback() -> None:
|
|
28
|
+
"""
|
|
29
|
+
Create, manage, and push Nextmv Cloud applications.
|
|
30
|
+
|
|
31
|
+
A Nextmv application is an entity that contains a decision model as
|
|
32
|
+
executable code. An application can make a run by taking an input,
|
|
33
|
+
executing the decision model, and producing an output.
|
|
34
|
+
"""
|
|
35
|
+
pass
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud app create command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from nextmv.cli.configuration.config import build_client
|
|
10
|
+
from nextmv.cli.message import in_progress, print_json
|
|
11
|
+
from nextmv.cli.options import ProfileOption
|
|
12
|
+
from nextmv.cloud.application import Application
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def create(
|
|
20
|
+
app_id: Annotated[
|
|
21
|
+
str | None,
|
|
22
|
+
typer.Option(
|
|
23
|
+
"--app-id",
|
|
24
|
+
"-a",
|
|
25
|
+
help="An optional ID for the Nextmv Cloud application. If not provided, a random ID will be generated.",
|
|
26
|
+
envvar="NEXTMV_APP_ID",
|
|
27
|
+
metavar="APP_ID",
|
|
28
|
+
),
|
|
29
|
+
] = None,
|
|
30
|
+
default_experiment_instance: Annotated[
|
|
31
|
+
str | None,
|
|
32
|
+
typer.Option(
|
|
33
|
+
"--default-experiment-instance",
|
|
34
|
+
"-x",
|
|
35
|
+
help="An optional default experiment instance ID for the application.",
|
|
36
|
+
metavar="DEFAULT_EXPERIMENT_INSTANCE",
|
|
37
|
+
),
|
|
38
|
+
] = None,
|
|
39
|
+
default_instance_id: Annotated[
|
|
40
|
+
str | None,
|
|
41
|
+
typer.Option(
|
|
42
|
+
"--default-instance-id",
|
|
43
|
+
"-i",
|
|
44
|
+
help="An optional default instance ID for the application.",
|
|
45
|
+
metavar="DEFAULT_INSTANCE_ID",
|
|
46
|
+
),
|
|
47
|
+
] = None,
|
|
48
|
+
description: Annotated[
|
|
49
|
+
str | None,
|
|
50
|
+
typer.Option(
|
|
51
|
+
"--description",
|
|
52
|
+
"-d",
|
|
53
|
+
help="An optional description for the application.",
|
|
54
|
+
metavar="DESCRIPTION",
|
|
55
|
+
),
|
|
56
|
+
] = None,
|
|
57
|
+
exist_ok: Annotated[
|
|
58
|
+
bool,
|
|
59
|
+
typer.Option(
|
|
60
|
+
"--exist-ok",
|
|
61
|
+
"-e",
|
|
62
|
+
help="If an application with the given ID already exists, do not raise an error, and simply return it.",
|
|
63
|
+
),
|
|
64
|
+
] = False,
|
|
65
|
+
is_workflow: Annotated[
|
|
66
|
+
bool,
|
|
67
|
+
typer.Option(
|
|
68
|
+
"--is-workflow",
|
|
69
|
+
"-w",
|
|
70
|
+
help="Whether the application is a workflow.",
|
|
71
|
+
),
|
|
72
|
+
] = False,
|
|
73
|
+
name: Annotated[
|
|
74
|
+
str | None,
|
|
75
|
+
typer.Option(
|
|
76
|
+
"--name",
|
|
77
|
+
"-n",
|
|
78
|
+
help="An optional name for the application. If not provided, the application ID will be used as the name.",
|
|
79
|
+
metavar="NAME",
|
|
80
|
+
),
|
|
81
|
+
] = None,
|
|
82
|
+
profile: ProfileOption = None,
|
|
83
|
+
) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Create a new Nextmv Cloud application.
|
|
86
|
+
|
|
87
|
+
Use the --exist-ok flag to avoid errors when creating an application with
|
|
88
|
+
an ID that already exists. This is useful for scripts that need to ensure
|
|
89
|
+
an application exists without worrying about whether it was created
|
|
90
|
+
previously.
|
|
91
|
+
|
|
92
|
+
An application can be marked as a workflow using the --is-workflow flag.
|
|
93
|
+
Workflows allow for more complex decision-making processes by leveraging
|
|
94
|
+
[link=https://github.com/nextmv-io/nextpipe][bold]Nextpipe[/bold][/link] to
|
|
95
|
+
orchestrate multiple decision models.
|
|
96
|
+
|
|
97
|
+
[bold][underline]Examples[/underline][/bold]
|
|
98
|
+
|
|
99
|
+
- Create an application with the name [magenta]Hare App[/magenta]. A random ID will be generated.
|
|
100
|
+
$ [dim]nextmv cloud app create --name "Hare App"[/dim]
|
|
101
|
+
|
|
102
|
+
- Create an application with the specific ID [magenta]hare-app[/magenta].
|
|
103
|
+
$ [dim]nextmv cloud app create --name "Hare App" --app-id hare-app[/dim]
|
|
104
|
+
|
|
105
|
+
- Create an application with an ID and description.
|
|
106
|
+
$ [dim]nextmv cloud app create --name "Hare App" --app-id hare-app \\
|
|
107
|
+
--description "An application for routing hares"[/dim]
|
|
108
|
+
|
|
109
|
+
- Create an application, or get it if it already exists.
|
|
110
|
+
$ [dim]nextmv cloud app create --name "Hare App" --app-id hare-app --exist-ok[/dim]
|
|
111
|
+
|
|
112
|
+
- Create a workflow application.
|
|
113
|
+
$ [dim]nextmv cloud app create --name "Hare Workflow" --app-id hare-workflow --is-workflow[/dim]
|
|
114
|
+
|
|
115
|
+
- Create an application with a default instance ID.
|
|
116
|
+
$ [dim]nextmv cloud app create --name "Hare App" --app-id hare-app \\
|
|
117
|
+
--default-instance-id burrow[/dim]
|
|
118
|
+
|
|
119
|
+
- Create an application with a default experiment instance.
|
|
120
|
+
$ [dim]nextmv cloud app create --name "Hare App" --app-id hare-app \\
|
|
121
|
+
--default-experiment-instance experiment-v1[/dim]
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
client = build_client(profile)
|
|
125
|
+
if exist_ok:
|
|
126
|
+
in_progress(msg="Creating or getting application...")
|
|
127
|
+
else:
|
|
128
|
+
in_progress(msg="Creating application...")
|
|
129
|
+
|
|
130
|
+
cloud_app = Application.new(
|
|
131
|
+
client=client,
|
|
132
|
+
name=name,
|
|
133
|
+
id=app_id,
|
|
134
|
+
description=description,
|
|
135
|
+
is_workflow=is_workflow,
|
|
136
|
+
exist_ok=exist_ok,
|
|
137
|
+
default_instance_id=default_instance_id,
|
|
138
|
+
default_experiment_instance=default_experiment_instance,
|
|
139
|
+
)
|
|
140
|
+
print_json(cloud_app.to_dict())
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud app delete command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from nextmv.cli.configuration.config import build_app
|
|
10
|
+
from nextmv.cli.confirm import get_confirmation
|
|
11
|
+
from nextmv.cli.message import info, success
|
|
12
|
+
from nextmv.cli.options import AppIDOption, ProfileOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def delete(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
yes: Annotated[
|
|
22
|
+
bool,
|
|
23
|
+
typer.Option(
|
|
24
|
+
"--yes",
|
|
25
|
+
"-y",
|
|
26
|
+
help="Agree to deletion confirmation prompt. Useful for non-interactive sessions.",
|
|
27
|
+
),
|
|
28
|
+
] = False,
|
|
29
|
+
profile: ProfileOption = None,
|
|
30
|
+
) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Deletes a Nextmv Cloud application.
|
|
33
|
+
|
|
34
|
+
This action is permanent and cannot be undone. Use the --yes
|
|
35
|
+
flag to skip the confirmation prompt.
|
|
36
|
+
|
|
37
|
+
[bold][underline]Examples[/underline][/bold]
|
|
38
|
+
|
|
39
|
+
- Delete the application with the ID [magenta]hare-app[/magenta].
|
|
40
|
+
$ [dim]nextmv cloud app delete --app-id hare-app[/dim]
|
|
41
|
+
|
|
42
|
+
- Delete the application with the ID [magenta]hare-app[/magenta] without confirmation prompt.
|
|
43
|
+
$ [dim]nextmv cloud app delete --app-id hare-app --yes[/dim]
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
if not yes:
|
|
47
|
+
confirm = get_confirmation(
|
|
48
|
+
f"Are you sure you want to delete application [magenta]{app_id}[/magenta]? This action cannot be undone.",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
if not confirm:
|
|
52
|
+
info(f"Application [magenta]{app_id}[/magenta] will not be deleted.")
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
56
|
+
cloud_app.delete()
|
|
57
|
+
success(f"Application [magenta]{app_id}[/magenta] deleted successfully.")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud app exists command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.configuration.config import build_client
|
|
8
|
+
from nextmv.cli.message import in_progress, print_json
|
|
9
|
+
from nextmv.cli.options import AppIDOption, ProfileOption
|
|
10
|
+
from nextmv.cloud.application import Application
|
|
11
|
+
|
|
12
|
+
# Set up subcommand application.
|
|
13
|
+
app = typer.Typer()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.command()
|
|
17
|
+
def exists(
|
|
18
|
+
app_id: AppIDOption,
|
|
19
|
+
profile: ProfileOption = None,
|
|
20
|
+
) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Check if a Nextmv Cloud application exists.
|
|
23
|
+
|
|
24
|
+
This command is useful in scripting applications to verify the existence of
|
|
25
|
+
a Nextmv Cloud application by its ID.
|
|
26
|
+
|
|
27
|
+
[bold][underline]Examples[/underline][/bold]
|
|
28
|
+
|
|
29
|
+
- Check if the application with the ID [magenta]hare-app[/magenta] exists.
|
|
30
|
+
$ [dim]nextmv cloud app exists --app-id hare-app[/dim]
|
|
31
|
+
|
|
32
|
+
- Check if the application with the ID [magenta]hare-app[/magenta] exists.
|
|
33
|
+
Use the profile named [magenta]hare[/magenta].
|
|
34
|
+
$ [dim]nextmv cloud app exists --app-id hare-app --profile hare[/dim]
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
client = build_client(profile)
|
|
38
|
+
in_progress(msg="Checking if application exists...")
|
|
39
|
+
|
|
40
|
+
ok = Application.exists(
|
|
41
|
+
client=client,
|
|
42
|
+
id=app_id,
|
|
43
|
+
)
|
|
44
|
+
print_json({"exists": ok})
|