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,147 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud secrets 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.cloud.secrets.create import build_secrets
|
|
11
|
+
from nextmv.cli.configuration.config import build_app
|
|
12
|
+
from nextmv.cli.message import enum_values, error, print_json, success
|
|
13
|
+
from nextmv.cli.options import AppIDOption, ProfileOption, SecretsCollectionIDOption
|
|
14
|
+
from nextmv.cloud.secrets import SecretType
|
|
15
|
+
|
|
16
|
+
# Set up subcommand application.
|
|
17
|
+
app = typer.Typer()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@app.command()
|
|
21
|
+
def update(
|
|
22
|
+
app_id: AppIDOption,
|
|
23
|
+
secrets_collection_id: SecretsCollectionIDOption,
|
|
24
|
+
description: Annotated[
|
|
25
|
+
str | None,
|
|
26
|
+
typer.Option(
|
|
27
|
+
"--description",
|
|
28
|
+
"-d",
|
|
29
|
+
help="A new description for the secrets collection.",
|
|
30
|
+
metavar="DESCRIPTION",
|
|
31
|
+
),
|
|
32
|
+
] = None,
|
|
33
|
+
name: Annotated[
|
|
34
|
+
str | None,
|
|
35
|
+
typer.Option(
|
|
36
|
+
"--name",
|
|
37
|
+
"-n",
|
|
38
|
+
help="A new name for the secrets collection.",
|
|
39
|
+
metavar="NAME",
|
|
40
|
+
),
|
|
41
|
+
] = None,
|
|
42
|
+
output: Annotated[
|
|
43
|
+
str | None,
|
|
44
|
+
typer.Option(
|
|
45
|
+
"--output",
|
|
46
|
+
"-u",
|
|
47
|
+
help="Saves the updated secrets collection information to this location.",
|
|
48
|
+
metavar="OUTPUT_PATH",
|
|
49
|
+
),
|
|
50
|
+
] = None,
|
|
51
|
+
secrets: Annotated[
|
|
52
|
+
list[str] | None,
|
|
53
|
+
typer.Option(
|
|
54
|
+
"--secrets",
|
|
55
|
+
"-e",
|
|
56
|
+
help="Secrets to configure in the app. Data should be valid [magenta]json[/magenta]. "
|
|
57
|
+
"Pass multiple secrets by repeating the flag, or providing a list of objects. "
|
|
58
|
+
"Allowed values for [magenta]type[/magenta] are: "
|
|
59
|
+
f"{enum_values(SecretType)}. "
|
|
60
|
+
"Object format: [green]{'type': type, 'location': location, 'value': value}[/green]. "
|
|
61
|
+
"This will replace all existing secrets in the collection.",
|
|
62
|
+
metavar="SECRETS",
|
|
63
|
+
),
|
|
64
|
+
] = None,
|
|
65
|
+
profile: ProfileOption = None,
|
|
66
|
+
) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Update a Nextmv Cloud secrets collection.
|
|
69
|
+
|
|
70
|
+
You can update the name, description, and/or secrets of an existing
|
|
71
|
+
secrets collection. When updating secrets, all existing secrets will be
|
|
72
|
+
replaced with the new ones provided.
|
|
73
|
+
|
|
74
|
+
Secrets are provided as JSON objects using the [code]--secrets[/code] flag,
|
|
75
|
+
following the same format as the create command. You can provide secrets as:
|
|
76
|
+
- A single secret as a JSON object
|
|
77
|
+
- Multiple secrets by repeating the [code]--secrets[/code] flag
|
|
78
|
+
- Multiple secrets as a JSON array in a single [code]--secrets[/code] flag
|
|
79
|
+
|
|
80
|
+
[bold][underline]Examples[/underline][/bold]
|
|
81
|
+
|
|
82
|
+
- Update the name of a secrets collection.
|
|
83
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
84
|
+
--secrets-collection-id api-keys --name "Updated API Keys"[/green]
|
|
85
|
+
|
|
86
|
+
- Update the description of a secrets collection.
|
|
87
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
88
|
+
--secrets-collection-id api-keys \\
|
|
89
|
+
--description "Updated collection of API keys"[/green]
|
|
90
|
+
|
|
91
|
+
- Update both name and description.
|
|
92
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
93
|
+
--secrets-collection-id api-keys --name "Production API Keys" \\
|
|
94
|
+
--description "API keys for production environment"[/green]
|
|
95
|
+
|
|
96
|
+
- Replace all secrets in a collection with new secrets.
|
|
97
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
98
|
+
--secrets-collection-id api-keys \\
|
|
99
|
+
--secrets '{"type": "env", "location": "API_KEY", "value": "new-value"}' \\
|
|
100
|
+
--secrets '{"type": "env", "location": "DATABASE_URL", "value": "postgres://newhost"}'[/green]
|
|
101
|
+
|
|
102
|
+
- Replace all secrets with a JSON array.
|
|
103
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
104
|
+
--secrets-collection-id api-keys \\
|
|
105
|
+
--secrets '[{"type": "env", "location": "API_KEY", "value": "new-value"}, {...}]'[/green]
|
|
106
|
+
|
|
107
|
+
- Update multiple attributes at once and save the result.
|
|
108
|
+
$ [green]nextmv cloud secrets update --app-id hare-app \\
|
|
109
|
+
--secrets-collection-id api-keys --name "New Name" \\
|
|
110
|
+
--description "New Description" \\
|
|
111
|
+
--secrets '{"type": "env", "location": "NEW_KEY", "value": "new-value"}' \\
|
|
112
|
+
--output updated.json[/green]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
if name is None and description is None and secrets is None:
|
|
116
|
+
error(
|
|
117
|
+
"Provide at least one option to update: "
|
|
118
|
+
"[code]--name[/code], [code]--description[/code], or [code]--secrets[/code]."
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
122
|
+
|
|
123
|
+
# Build the secrets list if provided
|
|
124
|
+
secrets_list = None
|
|
125
|
+
if secrets is not None:
|
|
126
|
+
secrets_list = build_secrets(secrets)
|
|
127
|
+
|
|
128
|
+
collection = cloud_app.update_secrets_collection(
|
|
129
|
+
secrets_collection_id=secrets_collection_id,
|
|
130
|
+
name=name,
|
|
131
|
+
description=description,
|
|
132
|
+
secrets=secrets_list,
|
|
133
|
+
)
|
|
134
|
+
success(
|
|
135
|
+
f"Secrets collection [magenta]{secrets_collection_id}[/magenta] updated successfully "
|
|
136
|
+
f"in application [magenta]{app_id}[/magenta]."
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
if output is not None and output != "":
|
|
140
|
+
with open(output, "w") as f:
|
|
141
|
+
json.dump(collection.to_dict(), f, indent=2)
|
|
142
|
+
|
|
143
|
+
success(msg=f"Updated secrets collection information saved to [magenta]{output}[/magenta].")
|
|
144
|
+
|
|
145
|
+
return
|
|
146
|
+
|
|
147
|
+
print_json(collection.to_dict())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud batch command tree for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from nextmv.cli.cloud.shadow.create import app as create_app
|
|
8
|
+
from nextmv.cli.cloud.shadow.delete import app as delete_app
|
|
9
|
+
from nextmv.cli.cloud.shadow.get import app as get_app
|
|
10
|
+
from nextmv.cli.cloud.shadow.list import app as list_app
|
|
11
|
+
from nextmv.cli.cloud.shadow.metadata import app as metadata_app
|
|
12
|
+
from nextmv.cli.cloud.shadow.start import app as start_app
|
|
13
|
+
from nextmv.cli.cloud.shadow.stop import app as stop_app
|
|
14
|
+
from nextmv.cli.cloud.shadow.update import app as update_app
|
|
15
|
+
|
|
16
|
+
# Set up subcommand application.
|
|
17
|
+
app = typer.Typer()
|
|
18
|
+
app.add_typer(create_app)
|
|
19
|
+
app.add_typer(delete_app)
|
|
20
|
+
app.add_typer(get_app)
|
|
21
|
+
app.add_typer(list_app)
|
|
22
|
+
app.add_typer(metadata_app)
|
|
23
|
+
app.add_typer(start_app)
|
|
24
|
+
app.add_typer(stop_app)
|
|
25
|
+
app.add_typer(update_app)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@app.callback()
|
|
29
|
+
def callback() -> None:
|
|
30
|
+
"""
|
|
31
|
+
Create and manage Nextmv Cloud shadow tests.
|
|
32
|
+
"""
|
|
33
|
+
pass
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow create command for the Nextmv CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing import Annotated
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from nextmv.cli.configuration.config import build_app
|
|
12
|
+
from nextmv.cli.message import error, in_progress, print_json
|
|
13
|
+
from nextmv.cli.options import AppIDOption, ProfileOption
|
|
14
|
+
from nextmv.cloud.shadow import StartEvents, TerminationEvents
|
|
15
|
+
|
|
16
|
+
# Set up subcommand application.
|
|
17
|
+
app = typer.Typer()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@app.command()
|
|
21
|
+
def create(
|
|
22
|
+
app_id: AppIDOption,
|
|
23
|
+
comparisons: Annotated[
|
|
24
|
+
str,
|
|
25
|
+
typer.Option(
|
|
26
|
+
"--comparisons",
|
|
27
|
+
"-c",
|
|
28
|
+
help="Object mapping baseline instance IDs to a list of comparison instance IDs. "
|
|
29
|
+
"Data should be valid [magenta]json[/magenta]. "
|
|
30
|
+
"Object format: [green]{'baseline_id1': ['comparison_id1', 'comparison_id2'], 'baseline_id2': ...}[/green]",
|
|
31
|
+
metavar="COMPARISONS",
|
|
32
|
+
),
|
|
33
|
+
],
|
|
34
|
+
termination_maximum_runs: Annotated[
|
|
35
|
+
int,
|
|
36
|
+
typer.Option(
|
|
37
|
+
"--termination-maximum-runs",
|
|
38
|
+
"-m",
|
|
39
|
+
help="Maximum number of runs for the shadow test termination condition. Must be at least 1.",
|
|
40
|
+
metavar="TERMINATION_MAXIMUM_RUNS",
|
|
41
|
+
),
|
|
42
|
+
],
|
|
43
|
+
description: Annotated[
|
|
44
|
+
str | None,
|
|
45
|
+
typer.Option(
|
|
46
|
+
"--description",
|
|
47
|
+
"-d",
|
|
48
|
+
help="Description of the shadow test.",
|
|
49
|
+
metavar="DESCRIPTION",
|
|
50
|
+
),
|
|
51
|
+
] = None,
|
|
52
|
+
name: Annotated[
|
|
53
|
+
str | None,
|
|
54
|
+
typer.Option(
|
|
55
|
+
"--name",
|
|
56
|
+
"-n",
|
|
57
|
+
help="Name of the shadow test. If not provided, the ID will be used as the name.",
|
|
58
|
+
metavar="NAME",
|
|
59
|
+
),
|
|
60
|
+
] = None,
|
|
61
|
+
shadow_test_id: Annotated[
|
|
62
|
+
str | None,
|
|
63
|
+
typer.Option(
|
|
64
|
+
"--shadow-test-id",
|
|
65
|
+
"-s",
|
|
66
|
+
help="ID for the shadow test. Will be generated if not provided.",
|
|
67
|
+
envvar="NEXTMV_SHADOW_TEST_ID",
|
|
68
|
+
metavar="SHADOW_TEST_ID",
|
|
69
|
+
),
|
|
70
|
+
] = None,
|
|
71
|
+
start_time: Annotated[
|
|
72
|
+
datetime | None,
|
|
73
|
+
typer.Option(
|
|
74
|
+
"--start-time",
|
|
75
|
+
"-r",
|
|
76
|
+
formats=["%Y-%m-%dT%H:%M:%S%z"],
|
|
77
|
+
help="Scheduled time for shadow test start in [magenta]RFC 3339[/magenta] format. "
|
|
78
|
+
"Example: [magenta]'2024-01-01T00:00:00Z'[/magenta]",
|
|
79
|
+
metavar="START_TIME",
|
|
80
|
+
),
|
|
81
|
+
] = None,
|
|
82
|
+
termination_time: Annotated[
|
|
83
|
+
datetime | None,
|
|
84
|
+
typer.Option(
|
|
85
|
+
"--termination-time",
|
|
86
|
+
"-t",
|
|
87
|
+
help="Scheduled time for shadow test end in [magenta]RFC 3339[/magenta] format. "
|
|
88
|
+
"Example: [magenta]'2024-01-01T00:00:00Z'[/magenta]",
|
|
89
|
+
formats=["%Y-%m-%dT%H:%M:%S%z"],
|
|
90
|
+
metavar="TERMINATION_TIME",
|
|
91
|
+
),
|
|
92
|
+
] = None,
|
|
93
|
+
profile: ProfileOption = None,
|
|
94
|
+
) -> None:
|
|
95
|
+
"""
|
|
96
|
+
Create a new Nextmv Cloud shadow test in draft mode.
|
|
97
|
+
|
|
98
|
+
Use the [code]--comparisons[/code] option to define how to set up instance
|
|
99
|
+
comparisons. The value should be valid [magenta]json[/magenta]. The keys of
|
|
100
|
+
the comparisons object are the baseline instance IDs, and the values
|
|
101
|
+
are the candidate lists of instance IDs to compare against the respective
|
|
102
|
+
baseline.
|
|
103
|
+
|
|
104
|
+
Here is an example comparisons object:
|
|
105
|
+
[green]{
|
|
106
|
+
"baseline-instance-1": ["candidate-instance-1", "candidate-instance-2"],
|
|
107
|
+
"baseline-instance-2": ["candidate-instance-3"]
|
|
108
|
+
}[/green]
|
|
109
|
+
|
|
110
|
+
You may specify the [code]--start-time[/code] option to make the shadow
|
|
111
|
+
test start at a specific time. Alternatively, you may use the
|
|
112
|
+
[code]nextmv cloud shadow start[/code] command to start the test.
|
|
113
|
+
|
|
114
|
+
The [code]--termination-maximum-runs[/code] option is required and provides
|
|
115
|
+
control over when the shadow test should terminate, after said number of
|
|
116
|
+
runs. Alternatively, you may specify the [code]--termination-time[/code]
|
|
117
|
+
option or use the [code]nextmv cloud shadow stop[/code] command to stop the
|
|
118
|
+
test
|
|
119
|
+
|
|
120
|
+
[bold][underline]Examples[/underline][/bold]
|
|
121
|
+
|
|
122
|
+
- Create a shadow test with a baseline and two candidate instances:
|
|
123
|
+
$ [green]COMPARISONS='{
|
|
124
|
+
"fluffy-bunny-baseline": [
|
|
125
|
+
"hopping-candidate-ears",
|
|
126
|
+
"speedy-cottontail"
|
|
127
|
+
]
|
|
128
|
+
}'
|
|
129
|
+
nextmv cloud shadow create --app-id hare-app --shadow-test-id bunny-hop-shadow --name "Bunny Hop Showdown" \\
|
|
130
|
+
--comparisons "$COMPARISONS" --termination-maximum-runs 100[/green]
|
|
131
|
+
|
|
132
|
+
- Create a shadow test with multiple baselines and candidates:
|
|
133
|
+
$ [green]COMPARISONS='{
|
|
134
|
+
"fluffy-bunny-baseline": [
|
|
135
|
+
"hopping-candidate-ears"
|
|
136
|
+
],
|
|
137
|
+
"wise-old-rabbit": [
|
|
138
|
+
"burrow-master"
|
|
139
|
+
]
|
|
140
|
+
}'
|
|
141
|
+
nextmv cloud shadow create --app-id hare-app --shadow-test-id warren-race --name "Warren Race Test" \\
|
|
142
|
+
--comparisons "$COMPARISONS" --termination-maximum-runs 50[/green]
|
|
143
|
+
|
|
144
|
+
- Create a shadow test with a scheduled start and termination time:
|
|
145
|
+
$ [green]COMPARISONS='{
|
|
146
|
+
"fluffy-bunny-baseline": [
|
|
147
|
+
"hopping-candidate-ears"
|
|
148
|
+
]
|
|
149
|
+
}'
|
|
150
|
+
nextmv cloud shadow create --app-id hare-app --shadow-test-id sunrise-hop --name "Sunrise Hop Test" \\
|
|
151
|
+
--comparisons "$COMPARISONS" --start-time '2026-01-23T10:00:00Z' \\
|
|
152
|
+
--termination-time '2026-01-23T18:00:00Z' --termination-maximum-runs 20[/green]
|
|
153
|
+
|
|
154
|
+
- Create a shadow test with a description:
|
|
155
|
+
$ [green]COMPARISONS='{
|
|
156
|
+
"fluffy-bunny-baseline": [
|
|
157
|
+
"hopping-candidate-ears"
|
|
158
|
+
]
|
|
159
|
+
}'
|
|
160
|
+
nextmv cloud shadow create --app-id hare-app --shadow-test-id carrot-compare --name "Carrot Comparison" \\
|
|
161
|
+
--description "Testing cool bunnies" --comparisons "$COMPARISONS" --termination-maximum-runs 10[/green]
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
165
|
+
|
|
166
|
+
try:
|
|
167
|
+
comparisons_dict = json.loads(comparisons)
|
|
168
|
+
except json.JSONDecodeError as e:
|
|
169
|
+
error(f"Invalid comparisons format: [magenta]{comparisons}[/magenta]. Error: {e}")
|
|
170
|
+
|
|
171
|
+
in_progress(msg="Creating shadow test...")
|
|
172
|
+
shadow_test = cloud_app.new_shadow_test(
|
|
173
|
+
comparisons=comparisons_dict,
|
|
174
|
+
termination_events=TerminationEvents(
|
|
175
|
+
maximum_runs=termination_maximum_runs,
|
|
176
|
+
time=termination_time,
|
|
177
|
+
),
|
|
178
|
+
shadow_test_id=shadow_test_id,
|
|
179
|
+
name=name,
|
|
180
|
+
description=description,
|
|
181
|
+
start_events=StartEvents(time=start_time) if start_time is not None else None,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
print_json(shadow_test.to_dict())
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow 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, ShadowTestIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def delete(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
shadow_test_id: ShadowTestIDOption,
|
|
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 shadow test.
|
|
34
|
+
|
|
35
|
+
This action is permanent and cannot be undone. The shadow test and all
|
|
36
|
+
associated data, including runs, will be deleted. Use the [code]--yes[/code]
|
|
37
|
+
flag to skip the confirmation prompt.
|
|
38
|
+
|
|
39
|
+
[bold][underline]Examples[/underline][/bold]
|
|
40
|
+
|
|
41
|
+
- Delete the shadow test with the ID [magenta]hop-analysis[/magenta] from application
|
|
42
|
+
[magenta]hare-app[/magenta].
|
|
43
|
+
$ [green]nextmv cloud shadow delete --app-id hare-app --shadow-test-id hop-analysis[/green]
|
|
44
|
+
|
|
45
|
+
- Delete the shadow test without confirmation prompt.
|
|
46
|
+
$ [green]nextmv cloud shadow delete --app-id hare-app --shadow-test-id carrot-routes --yes[/green]
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
if not yes:
|
|
50
|
+
confirm = Confirm.ask(
|
|
51
|
+
f"Are you sure you want to delete shadow test [magenta]{shadow_test_id}[/magenta] "
|
|
52
|
+
f"from application [magenta]{app_id}[/magenta]? This action cannot be undone.",
|
|
53
|
+
default=False,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
if not confirm:
|
|
57
|
+
info(
|
|
58
|
+
msg=f"Shadow test [magenta]{shadow_test_id}[/magenta] will not be deleted.",
|
|
59
|
+
emoji=":bulb:",
|
|
60
|
+
)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
64
|
+
cloud_app.delete_shadow_test(shadow_test_id=shadow_test_id)
|
|
65
|
+
success(
|
|
66
|
+
f"Shadow test [magenta]{shadow_test_id}[/magenta] deleted successfully "
|
|
67
|
+
f"from application [magenta]{app_id}[/magenta]."
|
|
68
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow 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, ShadowTestIDOption
|
|
13
|
+
|
|
14
|
+
# Set up subcommand application.
|
|
15
|
+
app = typer.Typer()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command()
|
|
19
|
+
def get(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
shadow_test_id: ShadowTestIDOption,
|
|
22
|
+
output: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--output",
|
|
26
|
+
"-o",
|
|
27
|
+
help="Saves the results to this location.",
|
|
28
|
+
metavar="OUTPUT_PATH",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
profile: ProfileOption = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Get a Nextmv Cloud shadow test, including its runs.
|
|
35
|
+
|
|
36
|
+
[bold][underline]Examples[/underline][/bold]
|
|
37
|
+
|
|
38
|
+
- Get the shadow test with ID [magenta]carrot-optimization[/magenta] from application
|
|
39
|
+
[magenta]hare-app[/magenta].
|
|
40
|
+
$ [green]nextmv cloud shadow get --app-id hare-app --shadow-test-id carrot-optimization[/green]
|
|
41
|
+
|
|
42
|
+
- Get the shadow test using a specific profile.
|
|
43
|
+
$ [green]nextmv cloud shadow get --app-id hare-app --shadow-test-id lettuce-routes --profile prod[/green]
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
47
|
+
in_progress(msg="Getting shadow test...")
|
|
48
|
+
shadow_test = cloud_app.shadow_test(shadow_test_id=shadow_test_id)
|
|
49
|
+
|
|
50
|
+
shadow_test_dict = shadow_test.to_dict()
|
|
51
|
+
|
|
52
|
+
# Handle output
|
|
53
|
+
if output is not None and output != "":
|
|
54
|
+
with open(output, "w") as f:
|
|
55
|
+
json.dump(shadow_test_dict, f, indent=2)
|
|
56
|
+
|
|
57
|
+
success(msg=f"Shadow test output saved to [magenta]{output}[/magenta].")
|
|
58
|
+
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
print_json(shadow_test_dict)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow 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 list of shadow tests to this location.",
|
|
27
|
+
metavar="OUTPUT_PATH",
|
|
28
|
+
),
|
|
29
|
+
] = None,
|
|
30
|
+
profile: ProfileOption = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""
|
|
33
|
+
List all Nextmv Cloud shadow tests for an application.
|
|
34
|
+
|
|
35
|
+
This command retrieves all shadow tests associated with the specified
|
|
36
|
+
application.
|
|
37
|
+
|
|
38
|
+
[bold][underline]Examples[/underline][/bold]
|
|
39
|
+
|
|
40
|
+
- List all shadow tests for application [magenta]hare-app[/magenta].
|
|
41
|
+
$ [green]nextmv cloud shadow list --app-id hare-app[/green]
|
|
42
|
+
|
|
43
|
+
- List all shadow tests and save to a file.
|
|
44
|
+
$ [green]nextmv cloud shadow list --app-id hare-app --output tests.json[/green]
|
|
45
|
+
|
|
46
|
+
- List all shadow tests using a specific profile.
|
|
47
|
+
$ [green]nextmv cloud shadow list --app-id hare-app --profile prod[/green]
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
51
|
+
in_progress(msg="Listing shadow tests...")
|
|
52
|
+
shadow_tests = cloud_app.list_shadow_tests()
|
|
53
|
+
shadow_tests_dict = [test.to_dict() for test in shadow_tests]
|
|
54
|
+
|
|
55
|
+
if output is not None and output != "":
|
|
56
|
+
with open(output, "w") as f:
|
|
57
|
+
json.dump(shadow_tests_dict, f, indent=2)
|
|
58
|
+
|
|
59
|
+
success(msg=f"Shadow tests list saved to [magenta]{output}[/magenta].")
|
|
60
|
+
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
print_json(shadow_tests_dict)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow metadata 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 metadata(
|
|
20
|
+
app_id: AppIDOption,
|
|
21
|
+
shadow_test_id: ShadowTestIDOption,
|
|
22
|
+
output: Annotated[
|
|
23
|
+
str | None,
|
|
24
|
+
typer.Option(
|
|
25
|
+
"--output",
|
|
26
|
+
"-o",
|
|
27
|
+
help="Saves the shadow test metadata to this location.",
|
|
28
|
+
metavar="OUTPUT_PATH",
|
|
29
|
+
),
|
|
30
|
+
] = None,
|
|
31
|
+
profile: ProfileOption = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Get metadata for a Nextmv Cloud shadow test.
|
|
35
|
+
|
|
36
|
+
This command retrieves metadata for a specific shadow test, including
|
|
37
|
+
status, creation date, and other high-level information without the full
|
|
38
|
+
run details.
|
|
39
|
+
|
|
40
|
+
[bold][underline]Examples[/underline][/bold]
|
|
41
|
+
|
|
42
|
+
- Get metadata for shadow test [magenta]bunny-warren-optimization[/magenta] from application
|
|
43
|
+
[magenta]hare-app[/magenta].
|
|
44
|
+
$ [green]nextmv cloud shadow metadata --app-id hare-app --shadow-test-id bunny-warren-optimization[/green]
|
|
45
|
+
|
|
46
|
+
- Get metadata and save to a file.
|
|
47
|
+
$ [green]nextmv cloud shadow metadata --app-id hare-app --shadow-test-id lettuce-delivery \\
|
|
48
|
+
--output metadata.json[/green]
|
|
49
|
+
|
|
50
|
+
- Get metadata using a specific profile.
|
|
51
|
+
$ [green]nextmv cloud shadow metadata --app-id hare-app --shadow-test-id hop-schedule --profile prod[/green]
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
cloud_app = build_app(app_id=app_id, profile=profile)
|
|
55
|
+
in_progress(msg="Getting shadow test metadata...")
|
|
56
|
+
shadow_metadata = cloud_app.shadow_test_metadata(shadow_test_id=shadow_test_id)
|
|
57
|
+
shadow_metadata_dict = shadow_metadata.to_dict()
|
|
58
|
+
|
|
59
|
+
if output is not None and output != "":
|
|
60
|
+
with open(output, "w") as f:
|
|
61
|
+
json.dump(shadow_metadata_dict, f, indent=2)
|
|
62
|
+
|
|
63
|
+
success(msg=f"Shadow test metadata saved to [magenta]{output}[/magenta].")
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
print_json(shadow_metadata_dict)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines the cloud shadow start 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 start(
|
|
17
|
+
app_id: AppIDOption,
|
|
18
|
+
shadow_test_id: ShadowTestIDOption,
|
|
19
|
+
profile: ProfileOption = None,
|
|
20
|
+
) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Starts a Nextmv Cloud shadow test.
|
|
23
|
+
|
|
24
|
+
Before starting a shadow test, it must be created in draft state. You may
|
|
25
|
+
use the [code]nextmv cloud shadow create[/code] command to create a new
|
|
26
|
+
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
|
+
)
|