nextmv 0.18.0__py3-none-any.whl → 1.0.0.dev2__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 +8 -13
- nextmv/__init__.py +53 -0
- nextmv/_serialization.py +96 -0
- nextmv/base_model.py +54 -9
- nextmv/cli/CONTRIBUTING.md +511 -0
- nextmv/cli/__init__.py +0 -0
- nextmv/cli/cloud/__init__.py +47 -0
- nextmv/cli/cloud/acceptance/__init__.py +27 -0
- nextmv/cli/cloud/acceptance/create.py +393 -0
- nextmv/cli/cloud/acceptance/delete.py +68 -0
- nextmv/cli/cloud/acceptance/get.py +104 -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 +60 -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 +141 -0
- nextmv/cli/cloud/app/delete.py +58 -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 +137 -0
- nextmv/cli/cloud/app/update.py +124 -0
- nextmv/cli/cloud/batch/__init__.py +29 -0
- nextmv/cli/cloud/batch/create.py +454 -0
- nextmv/cli/cloud/batch/delete.py +68 -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 +31 -0
- nextmv/cli/cloud/ensemble/create.py +414 -0
- nextmv/cli/cloud/ensemble/delete.py +67 -0
- nextmv/cli/cloud/ensemble/get.py +65 -0
- nextmv/cli/cloud/ensemble/update.py +103 -0
- nextmv/cli/cloud/input_set/__init__.py +30 -0
- nextmv/cli/cloud/input_set/create.py +170 -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 +290 -0
- nextmv/cli/cloud/instance/delete.py +62 -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 +146 -0
- nextmv/cli/cloud/managed_input/delete.py +65 -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 +530 -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 +167 -0
- nextmv/cli/cloud/run/metadata.py +67 -0
- nextmv/cli/cloud/run/track.py +501 -0
- nextmv/cli/cloud/scenario/__init__.py +29 -0
- nextmv/cli/cloud/scenario/create.py +451 -0
- nextmv/cli/cloud/scenario/delete.py +65 -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 +67 -0
- nextmv/cli/cloud/secrets/get.py +66 -0
- nextmv/cli/cloud/secrets/list.py +60 -0
- nextmv/cli/cloud/secrets/update.py +147 -0
- nextmv/cli/cloud/shadow/__init__.py +33 -0
- nextmv/cli/cloud/shadow/create.py +184 -0
- nextmv/cli/cloud/shadow/delete.py +68 -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 +43 -0
- nextmv/cli/cloud/shadow/update.py +95 -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 +97 -0
- nextmv/cli/cloud/version/delete.py +62 -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 +270 -0
- nextmv/cli/community/list.py +265 -0
- nextmv/cli/configuration/__init__.py +23 -0
- nextmv/cli/configuration/config.py +195 -0
- nextmv/cli/configuration/create.py +94 -0
- nextmv/cli/configuration/delete.py +67 -0
- nextmv/cli/configuration/list.py +77 -0
- nextmv/cli/main.py +188 -0
- nextmv/cli/message.py +153 -0
- nextmv/cli/options.py +206 -0
- nextmv/cli/version.py +38 -0
- nextmv/cloud/__init__.py +71 -17
- nextmv/cloud/acceptance_test.py +757 -51
- nextmv/cloud/account.py +406 -17
- nextmv/cloud/application/__init__.py +957 -0
- nextmv/cloud/application/_acceptance.py +419 -0
- nextmv/cloud/application/_batch_scenario.py +860 -0
- nextmv/cloud/application/_ensemble.py +251 -0
- nextmv/cloud/application/_input_set.py +227 -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 +314 -0
- nextmv/cloud/application/_utils.py +54 -0
- nextmv/cloud/application/_version.py +303 -0
- nextmv/cloud/assets.py +48 -0
- nextmv/cloud/batch_experiment.py +294 -33
- nextmv/cloud/client.py +307 -66
- nextmv/cloud/ensemble.py +247 -0
- nextmv/cloud/input_set.py +120 -2
- nextmv/cloud/instance.py +133 -8
- nextmv/cloud/integration.py +533 -0
- nextmv/cloud/package.py +168 -53
- nextmv/cloud/scenario.py +410 -0
- nextmv/cloud/secrets.py +234 -0
- nextmv/cloud/shadow.py +190 -0
- nextmv/cloud/url.py +73 -0
- nextmv/cloud/version.py +132 -4
- nextmv/default_app/.gitignore +1 -0
- nextmv/default_app/README.md +32 -0
- nextmv/default_app/app.yaml +12 -0
- nextmv/default_app/input.json +5 -0
- nextmv/default_app/main.py +37 -0
- nextmv/default_app/requirements.txt +2 -0
- nextmv/default_app/src/__init__.py +0 -0
- nextmv/default_app/src/visuals.py +36 -0
- nextmv/deprecated.py +47 -0
- nextmv/input.py +861 -90
- nextmv/local/__init__.py +5 -0
- nextmv/local/application.py +1251 -0
- nextmv/local/executor.py +1042 -0
- nextmv/local/geojson_handler.py +323 -0
- nextmv/local/local.py +97 -0
- nextmv/local/plotly_handler.py +61 -0
- nextmv/local/runner.py +274 -0
- nextmv/logger.py +80 -9
- nextmv/manifest.py +1466 -0
- nextmv/model.py +241 -66
- nextmv/options.py +708 -115
- nextmv/output.py +1301 -274
- nextmv/polling.py +325 -0
- nextmv/run.py +1702 -0
- nextmv/safe.py +145 -0
- nextmv/status.py +122 -0
- nextmv-1.0.0.dev2.dist-info/METADATA +311 -0
- nextmv-1.0.0.dev2.dist-info/RECORD +170 -0
- {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/WHEEL +1 -1
- nextmv-1.0.0.dev2.dist-info/entry_points.txt +2 -0
- nextmv/cloud/application.py +0 -1405
- nextmv/cloud/manifest.py +0 -234
- nextmv/cloud/status.py +0 -29
- nextmv-0.18.0.dist-info/METADATA +0 -770
- nextmv-0.18.0.dist-info/RECORD +0 -25
- {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow stop command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.configuration.config import build_app
|
|
8
|
+
from nextmv.cli.message import in_progress, success
|
|
9
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, ShadowTestIDOption
|
|
10
|
+
|
|
11
|
+
# Set up subcommand application.
|
|
12
|
+
app = typer.Typer()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command()
|
|
16
|
+
def stop(
|
|
17
|
+
app_id: AppIDOption,
|
|
18
|
+
shadow_test_id: ShadowTestIDOption,
|
|
19
|
+
profile: ProfileOption = None,
|
|
20
|
+
) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Stops a Nextmv Cloud shadow test.
|
|
23
|
+
|
|
24
|
+
Before stopping a shadow test, it must be in a started state. You may
|
|
25
|
+
use the [code]nextmv cloud shadow start[/code] command to start
|
|
26
|
+
a shadow test. Alternatively, define a [code]--start-time[/code] when using
|
|
27
|
+
the [code]nextmv cloud shadow create[/code] command to have the shadow test
|
|
28
|
+
start automatically at a specific time.
|
|
29
|
+
|
|
30
|
+
[bold][underline]Examples[/underline][/bold]
|
|
31
|
+
|
|
32
|
+
- Start the shadow test with the ID [magenta]hop-analysis[/magenta] from application
|
|
33
|
+
[magenta]hare-app[/magenta].
|
|
34
|
+
$ [green]nextmv cloud shadow start --app-id hare-app --shadow-test-id hop-analysis[/green]
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
in_progress(msg="Starting shadow test...")
|
|
38
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
39
|
+
cloud_app.start_shadow_test(shadow_test_id=shadow_test_id)
|
|
40
|
+
success(
|
|
41
|
+
f"Shadow test [magenta]{shadow_test_id}[/magenta] started successfully "
|
|
42
|
+
f"in application [magenta]{app_id}[/magenta]."
|
|
43
|
+
)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow 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 AppIDOption, ProfileOption, ShadowTestIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def update(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
shadow_test_id: ShadowTestIDOption,
|
|
22
|
+
description: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--description",
|
|
26
|
+
"-d",
|
|
27
|
+
help="Updated description of the shadow 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 shadow 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 shadow test information to this location.",
|
|
46
|
+
metavar="OUTPUT_PATH",
|
|
47
|
+
),
|
|
48
|
+
] = None,
|
|
49
|
+
profile: ProfileOption = None,
|
|
50
|
+
) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Update a Nextmv Cloud shadow test.
|
|
53
|
+
|
|
54
|
+
Update the name and/or description of a shadow test. Any fields not
|
|
55
|
+
specified will remain unchanged.
|
|
56
|
+
|
|
57
|
+
[bold][underline]Examples[/underline][/bold]
|
|
58
|
+
|
|
59
|
+
- Update the name of a shadow test.
|
|
60
|
+
$ [green]nextmv cloud shadow update --app-id hare-app --shadow-test-id carrot-feast \\
|
|
61
|
+
--name "Spring Carrot Harvest"[/green]
|
|
62
|
+
|
|
63
|
+
- Update the description of a shadow test.
|
|
64
|
+
$ [green]nextmv cloud shadow update --app-id hare-app --shadow-test-id bunny-hop-routes \\
|
|
65
|
+
--description "Optimizing hop paths through the meadow"[/green]
|
|
66
|
+
|
|
67
|
+
- Update both name and description and save the result.
|
|
68
|
+
$ [green]nextmv cloud shadow update --app-id hare-app --shadow-test-id lettuce-delivery \\
|
|
69
|
+
--name "Warren Lettuce Express" --description "Fast lettuce delivery to all burrows" \\
|
|
70
|
+
--output updated-shadow-test.json[/green]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
74
|
+
|
|
75
|
+
in_progress(msg="Updating shadow test...")
|
|
76
|
+
shadow_test = cloud_app.update_shadow_test(
|
|
77
|
+
shadow_test_id=shadow_test_id,
|
|
78
|
+
name=name,
|
|
79
|
+
description=description,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
shadow_test_dict = shadow_test.to_dict()
|
|
83
|
+
success(
|
|
84
|
+
f"Shadow test [magenta]{shadow_test_id}[/magenta] updated successfully "
|
|
85
|
+
f"in application [magenta]{app_id}[/magenta]."
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
if output is not None and output != "":
|
|
89
|
+
with open(output, "w") as f:
|
|
90
|
+
json.dump(shadow_test_dict, f, indent=2)
|
|
91
|
+
|
|
92
|
+
success(msg=f"Updated shadow test information saved to [magenta]{output}[/magenta].")
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
print_json(shadow_test_dict)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud upload command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.cloud.upload.create import app as create_app
|
|
8
|
+
|
|
9
|
+
# Set up subcommand application.
|
|
10
|
+
app = typer.Typer()
|
|
11
|
+
app.add_typer(create_app)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@app.callback()
|
|
15
|
+
def callback() -> None:
|
|
16
|
+
"""
|
|
17
|
+
Create temporary upload URLs for Nextmv Cloud applications.
|
|
18
|
+
|
|
19
|
+
When data is too large, or you are working with multiple files, you can use
|
|
20
|
+
upload URLs to upload data directly to Nextmv Cloud storage.
|
|
21
|
+
"""
|
|
22
|
+
pass
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud upload create command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.configuration.config import build_app
|
|
8
|
+
from nextmv.cli.message import in_progress, print_json, success
|
|
9
|
+
from nextmv.cli.options import AppIDOption, ProfileOption
|
|
10
|
+
|
|
11
|
+
# Set up subcommand application.
|
|
12
|
+
app = typer.Typer()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command()
|
|
16
|
+
def create(
|
|
17
|
+
app_id: AppIDOption,
|
|
18
|
+
profile: ProfileOption = None,
|
|
19
|
+
) -> None:
|
|
20
|
+
"""
|
|
21
|
+
Create a new Nextmv Cloud application upload URL.
|
|
22
|
+
|
|
23
|
+
[bold][underline]Examples[/underline][/bold]
|
|
24
|
+
|
|
25
|
+
- Create an upload URL for application [magenta]hare-app[/magenta].
|
|
26
|
+
$ [green]nextmv cloud upload create --app-id hare-app[/green]
|
|
27
|
+
|
|
28
|
+
- Create an upload URL for application [magenta]hare-app[/magenta] using profile [magenta]hare[/magenta].
|
|
29
|
+
$ [green]nextmv cloud upload create --app-id hare-app --profile hare[/green]
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
33
|
+
in_progress(msg="Creating upload URL...")
|
|
34
|
+
upload_url = cloud_app.upload_url()
|
|
35
|
+
success(
|
|
36
|
+
f"Upload URL created for application [magenta]{app_id}[/magenta]. "
|
|
37
|
+
"This URL is valid for [magenta]10 minutes[/magenta]."
|
|
38
|
+
)
|
|
39
|
+
print_json(upload_url.to_dict())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.cloud.version.create import app as create_app
|
|
8
|
+
from nextmv.cli.cloud.version.delete import app as delete_app
|
|
9
|
+
from nextmv.cli.cloud.version.exists import app as exists_app
|
|
10
|
+
from nextmv.cli.cloud.version.get import app as get_app
|
|
11
|
+
from nextmv.cli.cloud.version.list import app as list_app
|
|
12
|
+
from nextmv.cli.cloud.version.update import app as update_app
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
app.add_typer(create_app)
|
|
17
|
+
app.add_typer(delete_app)
|
|
18
|
+
app.add_typer(exists_app)
|
|
19
|
+
app.add_typer(get_app)
|
|
20
|
+
app.add_typer(list_app)
|
|
21
|
+
app.add_typer(update_app)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@app.callback()
|
|
25
|
+
def callback() -> None:
|
|
26
|
+
"""
|
|
27
|
+
Create and manage Nextmv Cloud application versions.
|
|
28
|
+
|
|
29
|
+
A version represents a snapshot of an application's code at a specific
|
|
30
|
+
point in time. Versions are used to track changes to the decision model.
|
|
31
|
+
You can think of versions as Git tags for your Nextmv Cloud applications.
|
|
32
|
+
"""
|
|
33
|
+
pass
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version 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_app
|
|
10
|
+
from nextmv.cli.message import in_progress, print_json
|
|
11
|
+
from nextmv.cli.options import AppIDOption, ProfileOption
|
|
12
|
+
|
|
13
|
+
# Set up subcommand application.
|
|
14
|
+
app = typer.Typer()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command()
|
|
18
|
+
def create(
|
|
19
|
+
app_id: AppIDOption,
|
|
20
|
+
description: Annotated[
|
|
21
|
+
str | None,
|
|
22
|
+
typer.Option(
|
|
23
|
+
"--description",
|
|
24
|
+
"-d",
|
|
25
|
+
help="An optional description for the version.",
|
|
26
|
+
metavar="DESCRIPTION",
|
|
27
|
+
),
|
|
28
|
+
] = None,
|
|
29
|
+
exist_ok: Annotated[
|
|
30
|
+
bool,
|
|
31
|
+
typer.Option(
|
|
32
|
+
"--exist-ok",
|
|
33
|
+
"-e",
|
|
34
|
+
help="If a version with the given ID already exists, do not raise an error, and simply return it.",
|
|
35
|
+
),
|
|
36
|
+
] = False,
|
|
37
|
+
name: Annotated[
|
|
38
|
+
str | None,
|
|
39
|
+
typer.Option(
|
|
40
|
+
"--name",
|
|
41
|
+
"-n",
|
|
42
|
+
help="A name for the version. If a name is not provided, the version ID will be used as the name.",
|
|
43
|
+
metavar="NAME",
|
|
44
|
+
),
|
|
45
|
+
] = None,
|
|
46
|
+
version_id: Annotated[
|
|
47
|
+
str | None,
|
|
48
|
+
typer.Option(
|
|
49
|
+
"--version-id",
|
|
50
|
+
"-v",
|
|
51
|
+
help="The ID to assign to the new version. If not provided, a random ID will be generated.",
|
|
52
|
+
envvar="NEXTMV_VERSION_ID",
|
|
53
|
+
metavar="VERSION_ID",
|
|
54
|
+
),
|
|
55
|
+
] = None,
|
|
56
|
+
profile: ProfileOption = None,
|
|
57
|
+
) -> None:
|
|
58
|
+
"""
|
|
59
|
+
Create a new Nextmv Cloud application version.
|
|
60
|
+
|
|
61
|
+
Use the [code]--exist-ok[/code] flag to avoid errors when creating a
|
|
62
|
+
version with an ID that already exists. This is useful for scripts that
|
|
63
|
+
need to ensure a version exists without worrying about whether it was
|
|
64
|
+
created previously.
|
|
65
|
+
|
|
66
|
+
[bold][underline]Examples[/underline][/bold]
|
|
67
|
+
|
|
68
|
+
- Create a version for application [magenta]hare-app[/magenta]. A random ID will be generated.
|
|
69
|
+
$ [green]nextmv cloud version create --app-id hare-app[/green]
|
|
70
|
+
|
|
71
|
+
- Create a version with a specific name.
|
|
72
|
+
$ [green]nextmv cloud version create --app-id hare-app --name "v1.0.0"[/green]
|
|
73
|
+
|
|
74
|
+
- Create a version with a specific ID.
|
|
75
|
+
$ [green]nextmv cloud version create --app-id hare-app --version-id v1[/green]
|
|
76
|
+
|
|
77
|
+
- Create a version with a name and description.
|
|
78
|
+
$ [green]nextmv cloud version create --app-id hare-app --name "v1.0.0" \\
|
|
79
|
+
--description "Initial release with routing optimization"[/green]
|
|
80
|
+
|
|
81
|
+
- Create a version, or get it if it already exists.
|
|
82
|
+
$ [green]nextmv cloud version create --app-id hare-app --version-id v1 --exist-ok[/green]
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
86
|
+
if exist_ok:
|
|
87
|
+
in_progress(msg="Creating or getting version...")
|
|
88
|
+
else:
|
|
89
|
+
in_progress(msg="Creating version...")
|
|
90
|
+
|
|
91
|
+
version = cloud_app.new_version(
|
|
92
|
+
id=version_id,
|
|
93
|
+
name=name,
|
|
94
|
+
description=description,
|
|
95
|
+
exist_ok=exist_ok,
|
|
96
|
+
)
|
|
97
|
+
print_json(version.to_dict())
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version delete command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.prompt import Confirm
|
|
9
|
+
|
|
10
|
+
from nextmv.cli.configuration.config import build_app
|
|
11
|
+
from nextmv.cli.message import info, success
|
|
12
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, VersionIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def delete(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
version_id: VersionIDOption,
|
|
22
|
+
yes: Annotated[
|
|
23
|
+
bool,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--yes",
|
|
26
|
+
"-y",
|
|
27
|
+
help="Agree to deletion confirmation prompt. Useful for non-interactive sessions.",
|
|
28
|
+
),
|
|
29
|
+
] = False,
|
|
30
|
+
profile: ProfileOption = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Deletes a Nextmv Cloud application version.
|
|
34
|
+
|
|
35
|
+
This action is permanent and cannot be undone. Use the [code]--yes[/code]
|
|
36
|
+
flag to skip the confirmation prompt.
|
|
37
|
+
|
|
38
|
+
[bold][underline]Examples[/underline][/bold]
|
|
39
|
+
|
|
40
|
+
- Delete the version with the ID [magenta]v1[/magenta] from application [magenta]hare-app[/magenta].
|
|
41
|
+
$ [green]nextmv cloud version delete --app-id hare-app --version-id v1[/green]
|
|
42
|
+
|
|
43
|
+
- Delete the version without confirmation prompt.
|
|
44
|
+
$ [green]nextmv cloud version delete --app-id hare-app --version-id v1 --yes[/green]
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
if not yes:
|
|
48
|
+
confirm = Confirm.ask(
|
|
49
|
+
f"Are you sure you want to delete version [magenta]{version_id}[/magenta] "
|
|
50
|
+
f"from application [magenta]{app_id}[/magenta]? This action cannot be undone.",
|
|
51
|
+
default=False,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
if not confirm:
|
|
55
|
+
info(msg=f"Version [magenta]{version_id}[/magenta] will not be deleted.", emoji=":bulb:")
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
59
|
+
cloud_app.delete_version(version_id=version_id)
|
|
60
|
+
success(
|
|
61
|
+
f"Version [magenta]{version_id}[/magenta] deleted successfully from application [magenta]{app_id}[/magenta]."
|
|
62
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version exists command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.configuration.config import build_app
|
|
8
|
+
from nextmv.cli.message import in_progress, print_json
|
|
9
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, VersionIDOption
|
|
10
|
+
|
|
11
|
+
# Set up subcommand application.
|
|
12
|
+
app = typer.Typer()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command()
|
|
16
|
+
def exists(
|
|
17
|
+
app_id: AppIDOption,
|
|
18
|
+
version_id: VersionIDOption,
|
|
19
|
+
profile: ProfileOption = None,
|
|
20
|
+
) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Check if a Nextmv Cloud application version exists.
|
|
23
|
+
|
|
24
|
+
This command is useful in scripting applications to verify the existence of
|
|
25
|
+
a Nextmv Cloud application version by its ID.
|
|
26
|
+
|
|
27
|
+
[bold][underline]Examples[/underline][/bold]
|
|
28
|
+
|
|
29
|
+
- Check if the version with the ID [magenta]v1[/magenta] exists in application [magenta]hare-app[/magenta].
|
|
30
|
+
$ [green]nextmv cloud version exists --app-id hare-app --version-id v1[/green]
|
|
31
|
+
|
|
32
|
+
- Check if the version exists using the profile named [magenta]hare[/magenta].
|
|
33
|
+
$ [green]nextmv cloud version exists --app-id hare-app --version-id v1 --profile hare[/green]
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
37
|
+
in_progress(msg="Checking if version exists...")
|
|
38
|
+
ok = cloud_app.version_exists(version_id=version_id)
|
|
39
|
+
print_json({"exists": ok})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version 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_app
|
|
11
|
+
from nextmv.cli.message import in_progress, print_json, success
|
|
12
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, VersionIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def get(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
version_id: VersionIDOption,
|
|
22
|
+
output: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--output",
|
|
26
|
+
"-o",
|
|
27
|
+
help="Saves the version information to this location.",
|
|
28
|
+
metavar="OUTPUT_PATH",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
profile: ProfileOption = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Get a Nextmv Cloud application version.
|
|
35
|
+
|
|
36
|
+
This command is useful to get the attributes of an existing Nextmv Cloud
|
|
37
|
+
application version by its ID.
|
|
38
|
+
|
|
39
|
+
[bold][underline]Examples[/underline][/bold]
|
|
40
|
+
|
|
41
|
+
- Get the version with the ID [magenta]v1[/magenta] from application [magenta]hare-app[/magenta].
|
|
42
|
+
$ [green]nextmv cloud version get --app-id hare-app --version-id v1[/green]
|
|
43
|
+
|
|
44
|
+
- Get the version with the ID [magenta]v1[/magenta] and save the information to a
|
|
45
|
+
[magenta]version.json[/magenta] file.
|
|
46
|
+
$ [green]nextmv cloud version get --app-id hare-app --version-id v1 --output version.json[/green]
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
50
|
+
in_progress(msg="Getting version...")
|
|
51
|
+
version = cloud_app.version(version_id=version_id)
|
|
52
|
+
version_dict = version.to_dict()
|
|
53
|
+
|
|
54
|
+
if output is not None and output != "":
|
|
55
|
+
with open(output, "w") as f:
|
|
56
|
+
json.dump(version_dict, f, indent=2)
|
|
57
|
+
|
|
58
|
+
success(msg=f"Version information saved to [magenta]{output}[/magenta].")
|
|
59
|
+
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
print_json(version_dict)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version list 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 AppIDOption, ProfileOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def list(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
output: Annotated[
|
|
22
|
+
str | None,
|
|
23
|
+
typer.Option(
|
|
24
|
+
"--output",
|
|
25
|
+
"-o",
|
|
26
|
+
help="Saves the version list information to this location.",
|
|
27
|
+
metavar="OUTPUT_PATH",
|
|
28
|
+
),
|
|
29
|
+
] = None,
|
|
30
|
+
profile: ProfileOption = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""
|
|
33
|
+
List all versions of a Nextmv Cloud application.
|
|
34
|
+
|
|
35
|
+
[bold][underline]Examples[/underline][/bold]
|
|
36
|
+
|
|
37
|
+
- List all versions of application [magenta]hare-app[/magenta].
|
|
38
|
+
$ [green]nextmv cloud version list --app-id hare-app[/green]
|
|
39
|
+
|
|
40
|
+
- List all versions using the profile named [magenta]hare[/magenta].
|
|
41
|
+
$ [green]nextmv cloud version list --app-id hare-app --profile hare[/green]
|
|
42
|
+
|
|
43
|
+
- List all versions and save the information to a [magenta]versions.json[/magenta] file.
|
|
44
|
+
$ [green]nextmv cloud version list --app-id hare-app --output versions.json[/green]
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
48
|
+
in_progress(msg="Listing versions...")
|
|
49
|
+
versions = cloud_app.list_versions()
|
|
50
|
+
versions_dicts = [version.to_dict() for version in versions]
|
|
51
|
+
|
|
52
|
+
if output is not None and output != "":
|
|
53
|
+
with open(output, "w") as f:
|
|
54
|
+
json.dump(versions_dicts, f, indent=2)
|
|
55
|
+
|
|
56
|
+
success(msg=f"Version list information saved to [magenta]{output}[/magenta].")
|
|
57
|
+
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
print_json(versions_dicts)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud version 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 error, print_json, success
|
|
12
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, VersionIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def update(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
version_id: VersionIDOption,
|
|
22
|
+
description: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--description",
|
|
26
|
+
"-d",
|
|
27
|
+
help="A new description for the version.",
|
|
28
|
+
metavar="DESCRIPTION",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
name: Annotated[
|
|
32
|
+
str | None,
|
|
33
|
+
typer.Option(
|
|
34
|
+
"--name",
|
|
35
|
+
"-n",
|
|
36
|
+
help="A new name for the version.",
|
|
37
|
+
metavar="NAME",
|
|
38
|
+
),
|
|
39
|
+
] = None,
|
|
40
|
+
output: Annotated[
|
|
41
|
+
str | None,
|
|
42
|
+
typer.Option(
|
|
43
|
+
"--output",
|
|
44
|
+
"-o",
|
|
45
|
+
help="Saves the updated version information to this location.",
|
|
46
|
+
metavar="OUTPUT_PATH",
|
|
47
|
+
),
|
|
48
|
+
] = None,
|
|
49
|
+
profile: ProfileOption = None,
|
|
50
|
+
) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Updates a Nextmv Cloud application version.
|
|
53
|
+
|
|
54
|
+
[bold][underline]Examples[/underline][/bold]
|
|
55
|
+
|
|
56
|
+
- Update a version's name.
|
|
57
|
+
$ [green]nextmv cloud version update --app-id hare-app --version-id v1 --name "Version 1.0"[/green]
|
|
58
|
+
|
|
59
|
+
- Update a version's description.
|
|
60
|
+
$ [green]nextmv cloud version update --app-id hare-app --version-id v1 \\
|
|
61
|
+
--description "Initial stable release"[/green]
|
|
62
|
+
|
|
63
|
+
- Update a version's name and description at once.
|
|
64
|
+
$ [green]nextmv cloud version update --app-id hare-app --version-id v1 \\
|
|
65
|
+
--name "Version 1.0" --description "Initial stable release"[/green]
|
|
66
|
+
|
|
67
|
+
- Update a version and save the updated information to a [magenta]updated_version.json[/magenta] file.
|
|
68
|
+
$ [green]nextmv cloud version update --app-id hare-app --version-id v1 \\
|
|
69
|
+
--name "Version 1.0" --output updated_version.json[/green]
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
if name is None and description is None:
|
|
73
|
+
error("Provide at least one option to update: [code]--name[/code] or [code]--description[/code].")
|
|
74
|
+
|
|
75
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
76
|
+
updated_version = cloud_app.update_version(
|
|
77
|
+
version_id=version_id,
|
|
78
|
+
name=name,
|
|
79
|
+
description=description,
|
|
80
|
+
)
|
|
81
|
+
success(f"Version [magenta]{version_id}[/magenta] updated successfully in application [magenta]{app_id}[/magenta].")
|
|
82
|
+
updated_version_dict = updated_version.to_dict()
|
|
83
|
+
|
|
84
|
+
if output is not None and output != "":
|
|
85
|
+
with open(output, "w") as f:
|
|
86
|
+
json.dump(updated_version_dict, f, indent=2)
|
|
87
|
+
|
|
88
|
+
success(msg=f"Updated version information saved to [magenta]{output}[/magenta].")
|
|
89
|
+
|
|
90
|
+
return
|
|
91
|
+
|
|
92
|
+
print_json(updated_version_dict)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the community command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.community.clone import app as clone_app
|
|
8
|
+
from nextmv.cli.community.list import app as list_app
|
|
9
|
+
|
|
10
|
+
# Set up subcommand application.
|
|
11
|
+
app = typer.Typer()
|
|
12
|
+
app.add_typer(list_app)
|
|
13
|
+
app.add_typer(clone_app)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.callback()
|
|
17
|
+
def callback() -> None:
|
|
18
|
+
"""
|
|
19
|
+
Interact with community apps, which are pre-built decision models.
|
|
20
|
+
|
|
21
|
+
Community apps are maintained in the following GitHub repository:
|
|
22
|
+
[link=https://github.com/nextmv-io/community-apps][bold]nextmv-io/community-apps[/bold][/link].
|
|
23
|
+
"""
|
|
24
|
+
pass
|