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.
Files changed (161) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/__entrypoint__.py +1 -2
  3. nextmv/__init__.py +2 -4
  4. nextmv/cli/CONTRIBUTING.md +583 -0
  5. nextmv/cli/cloud/__init__.py +49 -0
  6. nextmv/cli/cloud/acceptance/__init__.py +27 -0
  7. nextmv/cli/cloud/acceptance/create.py +391 -0
  8. nextmv/cli/cloud/acceptance/delete.py +64 -0
  9. nextmv/cli/cloud/acceptance/get.py +103 -0
  10. nextmv/cli/cloud/acceptance/list.py +62 -0
  11. nextmv/cli/cloud/acceptance/update.py +95 -0
  12. nextmv/cli/cloud/account/__init__.py +28 -0
  13. nextmv/cli/cloud/account/create.py +83 -0
  14. nextmv/cli/cloud/account/delete.py +59 -0
  15. nextmv/cli/cloud/account/get.py +66 -0
  16. nextmv/cli/cloud/account/update.py +70 -0
  17. nextmv/cli/cloud/app/__init__.py +35 -0
  18. nextmv/cli/cloud/app/create.py +140 -0
  19. nextmv/cli/cloud/app/delete.py +57 -0
  20. nextmv/cli/cloud/app/exists.py +44 -0
  21. nextmv/cli/cloud/app/get.py +66 -0
  22. nextmv/cli/cloud/app/list.py +61 -0
  23. nextmv/cli/cloud/app/push.py +432 -0
  24. nextmv/cli/cloud/app/update.py +124 -0
  25. nextmv/cli/cloud/batch/__init__.py +29 -0
  26. nextmv/cli/cloud/batch/create.py +452 -0
  27. nextmv/cli/cloud/batch/delete.py +64 -0
  28. nextmv/cli/cloud/batch/get.py +104 -0
  29. nextmv/cli/cloud/batch/list.py +63 -0
  30. nextmv/cli/cloud/batch/metadata.py +66 -0
  31. nextmv/cli/cloud/batch/update.py +95 -0
  32. nextmv/cli/cloud/data/__init__.py +26 -0
  33. nextmv/cli/cloud/data/upload.py +162 -0
  34. nextmv/cli/cloud/ensemble/__init__.py +33 -0
  35. nextmv/cli/cloud/ensemble/create.py +413 -0
  36. nextmv/cli/cloud/ensemble/delete.py +63 -0
  37. nextmv/cli/cloud/ensemble/get.py +65 -0
  38. nextmv/cli/cloud/ensemble/list.py +63 -0
  39. nextmv/cli/cloud/ensemble/update.py +103 -0
  40. nextmv/cli/cloud/input_set/__init__.py +32 -0
  41. nextmv/cli/cloud/input_set/create.py +168 -0
  42. nextmv/cli/cloud/input_set/delete.py +64 -0
  43. nextmv/cli/cloud/input_set/get.py +63 -0
  44. nextmv/cli/cloud/input_set/list.py +63 -0
  45. nextmv/cli/cloud/input_set/update.py +123 -0
  46. nextmv/cli/cloud/instance/__init__.py +35 -0
  47. nextmv/cli/cloud/instance/create.py +289 -0
  48. nextmv/cli/cloud/instance/delete.py +61 -0
  49. nextmv/cli/cloud/instance/exists.py +39 -0
  50. nextmv/cli/cloud/instance/get.py +62 -0
  51. nextmv/cli/cloud/instance/list.py +60 -0
  52. nextmv/cli/cloud/instance/update.py +216 -0
  53. nextmv/cli/cloud/managed_input/__init__.py +31 -0
  54. nextmv/cli/cloud/managed_input/create.py +144 -0
  55. nextmv/cli/cloud/managed_input/delete.py +64 -0
  56. nextmv/cli/cloud/managed_input/get.py +63 -0
  57. nextmv/cli/cloud/managed_input/list.py +60 -0
  58. nextmv/cli/cloud/managed_input/update.py +97 -0
  59. nextmv/cli/cloud/run/__init__.py +37 -0
  60. nextmv/cli/cloud/run/cancel.py +37 -0
  61. nextmv/cli/cloud/run/create.py +524 -0
  62. nextmv/cli/cloud/run/get.py +199 -0
  63. nextmv/cli/cloud/run/input.py +86 -0
  64. nextmv/cli/cloud/run/list.py +80 -0
  65. nextmv/cli/cloud/run/logs.py +166 -0
  66. nextmv/cli/cloud/run/metadata.py +67 -0
  67. nextmv/cli/cloud/run/track.py +500 -0
  68. nextmv/cli/cloud/scenario/__init__.py +29 -0
  69. nextmv/cli/cloud/scenario/create.py +451 -0
  70. nextmv/cli/cloud/scenario/delete.py +61 -0
  71. nextmv/cli/cloud/scenario/get.py +102 -0
  72. nextmv/cli/cloud/scenario/list.py +63 -0
  73. nextmv/cli/cloud/scenario/metadata.py +67 -0
  74. nextmv/cli/cloud/scenario/update.py +93 -0
  75. nextmv/cli/cloud/secrets/__init__.py +33 -0
  76. nextmv/cli/cloud/secrets/create.py +206 -0
  77. nextmv/cli/cloud/secrets/delete.py +63 -0
  78. nextmv/cli/cloud/secrets/get.py +66 -0
  79. nextmv/cli/cloud/secrets/list.py +60 -0
  80. nextmv/cli/cloud/secrets/update.py +144 -0
  81. nextmv/cli/cloud/shadow/__init__.py +33 -0
  82. nextmv/cli/cloud/shadow/create.py +184 -0
  83. nextmv/cli/cloud/shadow/delete.py +64 -0
  84. nextmv/cli/cloud/shadow/get.py +61 -0
  85. nextmv/cli/cloud/shadow/list.py +63 -0
  86. nextmv/cli/cloud/shadow/metadata.py +66 -0
  87. nextmv/cli/cloud/shadow/start.py +43 -0
  88. nextmv/cli/cloud/shadow/stop.py +53 -0
  89. nextmv/cli/cloud/shadow/update.py +96 -0
  90. nextmv/cli/cloud/switchback/__init__.py +33 -0
  91. nextmv/cli/cloud/switchback/create.py +151 -0
  92. nextmv/cli/cloud/switchback/delete.py +64 -0
  93. nextmv/cli/cloud/switchback/get.py +62 -0
  94. nextmv/cli/cloud/switchback/list.py +63 -0
  95. nextmv/cli/cloud/switchback/metadata.py +68 -0
  96. nextmv/cli/cloud/switchback/start.py +43 -0
  97. nextmv/cli/cloud/switchback/stop.py +53 -0
  98. nextmv/cli/cloud/switchback/update.py +96 -0
  99. nextmv/cli/cloud/upload/__init__.py +22 -0
  100. nextmv/cli/cloud/upload/create.py +39 -0
  101. nextmv/cli/cloud/version/__init__.py +33 -0
  102. nextmv/cli/cloud/version/create.py +96 -0
  103. nextmv/cli/cloud/version/delete.py +61 -0
  104. nextmv/cli/cloud/version/exists.py +39 -0
  105. nextmv/cli/cloud/version/get.py +62 -0
  106. nextmv/cli/cloud/version/list.py +60 -0
  107. nextmv/cli/cloud/version/update.py +92 -0
  108. nextmv/cli/community/__init__.py +24 -0
  109. nextmv/cli/community/clone.py +86 -0
  110. nextmv/cli/community/list.py +200 -0
  111. nextmv/cli/configuration/__init__.py +23 -0
  112. nextmv/cli/configuration/config.py +228 -0
  113. nextmv/cli/configuration/create.py +94 -0
  114. nextmv/cli/configuration/delete.py +67 -0
  115. nextmv/cli/configuration/list.py +77 -0
  116. nextmv/cli/confirm.py +34 -0
  117. nextmv/cli/main.py +161 -3
  118. nextmv/cli/message.py +170 -0
  119. nextmv/cli/options.py +220 -0
  120. nextmv/cli/version.py +22 -2
  121. nextmv/cloud/__init__.py +17 -38
  122. nextmv/cloud/acceptance_test.py +20 -83
  123. nextmv/cloud/account.py +269 -30
  124. nextmv/cloud/application/__init__.py +898 -0
  125. nextmv/cloud/application/_acceptance.py +424 -0
  126. nextmv/cloud/application/_batch_scenario.py +845 -0
  127. nextmv/cloud/application/_ensemble.py +251 -0
  128. nextmv/cloud/application/_input_set.py +263 -0
  129. nextmv/cloud/application/_instance.py +289 -0
  130. nextmv/cloud/application/_managed_input.py +227 -0
  131. nextmv/cloud/application/_run.py +1393 -0
  132. nextmv/cloud/application/_secrets.py +294 -0
  133. nextmv/cloud/application/_shadow.py +320 -0
  134. nextmv/cloud/application/_switchback.py +332 -0
  135. nextmv/cloud/application/_utils.py +54 -0
  136. nextmv/cloud/application/_version.py +304 -0
  137. nextmv/cloud/batch_experiment.py +6 -2
  138. nextmv/cloud/community.py +446 -0
  139. nextmv/cloud/instance.py +11 -1
  140. nextmv/cloud/integration.py +8 -5
  141. nextmv/cloud/package.py +50 -9
  142. nextmv/cloud/shadow.py +254 -0
  143. nextmv/cloud/switchback.py +228 -0
  144. nextmv/deprecated.py +5 -3
  145. nextmv/input.py +20 -88
  146. nextmv/local/application.py +3 -15
  147. nextmv/local/runner.py +1 -1
  148. nextmv/model.py +50 -11
  149. nextmv/options.py +11 -256
  150. nextmv/output.py +0 -62
  151. nextmv/polling.py +54 -16
  152. nextmv/run.py +84 -37
  153. nextmv/status.py +1 -51
  154. {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/METADATA +37 -11
  155. nextmv-1.0.0.dist-info/RECORD +185 -0
  156. nextmv-1.0.0.dist-info/entry_points.txt +2 -0
  157. nextmv/cloud/application.py +0 -4204
  158. nextmv-0.39.0.dev1.dist-info/RECORD +0 -55
  159. nextmv-0.39.0.dev1.dist-info/entry_points.txt +0 -2
  160. {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/WHEEL +0 -0
  161. {nextmv-0.39.0.dev1.dist-info → nextmv-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,216 @@
1
+ """
2
+ This module defines the cloud instance 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.instance.create import build_config, build_options
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, InstanceIDOption, ProfileOption
14
+ from nextmv.input import InputFormat
15
+
16
+ # Set up subcommand application.
17
+ app = typer.Typer()
18
+
19
+
20
+ @app.command()
21
+ def update(
22
+ app_id: AppIDOption,
23
+ instance_id: InstanceIDOption,
24
+ description: Annotated[
25
+ str | None,
26
+ typer.Option(
27
+ "--description",
28
+ "-d",
29
+ help="A new description for the instance.",
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 instance.",
39
+ metavar="NAME",
40
+ ),
41
+ ] = None,
42
+ output: Annotated[
43
+ str | None,
44
+ typer.Option(
45
+ "--output",
46
+ "-u",
47
+ help="Saves the updated instance information to this location.",
48
+ metavar="OUTPUT_PATH",
49
+ ),
50
+ ] = None,
51
+ version_id: Annotated[
52
+ str | None,
53
+ typer.Option(
54
+ "--version-id",
55
+ "-v",
56
+ help="Update the instance to use a different version.",
57
+ metavar="VERSION_ID",
58
+ ),
59
+ ] = None,
60
+ # Options for updating the instance configuration.
61
+ content_format: Annotated[
62
+ InputFormat | None,
63
+ typer.Option(
64
+ "--content-format",
65
+ "-c",
66
+ help=f"The content format for the instance. Allowed values are: {enum_values(InputFormat)}.",
67
+ metavar="CONTENT_FORMAT",
68
+ rich_help_panel="Instance configuration",
69
+ ),
70
+ ] = None,
71
+ execution_class: Annotated[
72
+ str | None,
73
+ typer.Option(
74
+ "--execution-class",
75
+ "-x",
76
+ help="The execution class to use for the instance.",
77
+ metavar="EXECUTION_CLASS",
78
+ rich_help_panel="Instance configuration",
79
+ ),
80
+ ] = None,
81
+ integration_id: Annotated[
82
+ str | None,
83
+ typer.Option(
84
+ help="The integration ID to use for the runs of the instance, if applicable.",
85
+ metavar="INTEGRATION_ID",
86
+ rich_help_panel="Instance configuration",
87
+ ),
88
+ ] = None,
89
+ no_queuing: Annotated[
90
+ bool | None,
91
+ typer.Option(
92
+ "--no-queuing",
93
+ help="Do not queue when running the instance.",
94
+ rich_help_panel="Instance configuration",
95
+ ),
96
+ ] = None,
97
+ options: Annotated[
98
+ list[str] | None,
99
+ typer.Option(
100
+ "--options",
101
+ "-o",
102
+ help="Options to always use when running the instance. Format: [magenta]key=value[/magenta]. "
103
+ "Pass multiple options by repeating the flag, or separating with commas.",
104
+ metavar="KEY=VALUE",
105
+ rich_help_panel="Instance configuration",
106
+ ),
107
+ ] = None,
108
+ priority: Annotated[
109
+ int | None,
110
+ typer.Option(
111
+ help="The priority of the runs in the instance. "
112
+ "Priority is between 1 and 10, with 1 being the highest priority.",
113
+ metavar="PRIORITY",
114
+ rich_help_panel="Instance configuration",
115
+ ),
116
+ ] = None,
117
+ secret_collection_id: Annotated[
118
+ str | None,
119
+ typer.Option(
120
+ "--secret-collection-id",
121
+ "-s",
122
+ help="The secret collection ID to use for the instance, if applicable.",
123
+ metavar="SECRET_COLLECTION_ID",
124
+ rich_help_panel="Instance configuration",
125
+ ),
126
+ ] = None,
127
+ profile: ProfileOption = None,
128
+ ) -> None:
129
+ """
130
+ Updates a Nextmv Cloud application instance.
131
+
132
+ [bold][underline]Examples[/underline][/bold]
133
+
134
+ - Update an instance's name.
135
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod --name "Production Instance"[/dim]
136
+
137
+ - Update an instance's description.
138
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod \\
139
+ --description "Instance for production routing jobs"[/dim]
140
+
141
+ - Update an instance to use a different version.
142
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod --version-id v2[/dim]
143
+
144
+ - Update an instance's name and description at once.
145
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod \\
146
+ --name "Production Instance" --description "Instance for production routing jobs"[/dim]
147
+
148
+ - Update an instance and save the updated information to a [magenta]updated_instance.json[/magenta] file.
149
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod \\
150
+ --name "Production Instance" --output updated_instance.json[/dim]
151
+
152
+ - Update an instance's execution class and priority.
153
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod \\
154
+ --execution-class 6c9500mb870s --priority 1[/dim]
155
+
156
+ - Update an instance's runtime options.
157
+ $ [dim]nextmv cloud instance update --app-id hare-app --instance-id prod \\
158
+ --options max_duration=30 --options timeout=60[/dim]
159
+ """
160
+
161
+ # Check if any configuration options are provided
162
+ has_config_options = any(
163
+ [
164
+ content_format is not None,
165
+ execution_class is not None,
166
+ integration_id is not None,
167
+ no_queuing is not None,
168
+ options is not None,
169
+ priority is not None,
170
+ secret_collection_id is not None,
171
+ ]
172
+ )
173
+
174
+ if name is None and description is None and version_id is None and not has_config_options:
175
+ error(
176
+ "Provide at least one option to update: --name, --description, "
177
+ "--version-id, or any [magenta]Instance configuration[/magenta] option."
178
+ )
179
+
180
+ cloud_app = build_app(app_id=app_id, profile=profile)
181
+
182
+ # Build configuration if any configuration options were provided.
183
+ configuration = None
184
+ if has_config_options:
185
+ instance_options = build_options(options)
186
+ configuration = build_config(
187
+ priority=priority,
188
+ no_queuing=no_queuing,
189
+ content_format=content_format,
190
+ execution_class=execution_class,
191
+ integration_id=integration_id,
192
+ options=instance_options,
193
+ secret_collection_id=secret_collection_id,
194
+ )
195
+
196
+ updated_instance = cloud_app.update_instance(
197
+ id=instance_id,
198
+ name=name,
199
+ description=description,
200
+ version_id=version_id,
201
+ configuration=configuration,
202
+ )
203
+ success(
204
+ f"Instance [magenta]{instance_id}[/magenta] updated successfully in application [magenta]{app_id}[/magenta]."
205
+ )
206
+ updated_instance_dict = updated_instance.to_dict()
207
+
208
+ if output is not None and output != "":
209
+ with open(output, "w") as f:
210
+ json.dump(updated_instance_dict, f, indent=2)
211
+
212
+ success(msg=f"Updated instance information saved to [magenta]{output}[/magenta].")
213
+
214
+ return
215
+
216
+ print_json(updated_instance_dict)
@@ -0,0 +1,31 @@
1
+ """
2
+ This module defines the cloud managed-input command tree for the Nextmv CLI.
3
+ """
4
+
5
+ import typer
6
+
7
+ from nextmv.cli.cloud.managed_input.create import app as create_app
8
+ from nextmv.cli.cloud.managed_input.delete import app as delete_app
9
+ from nextmv.cli.cloud.managed_input.get import app as get_app
10
+ from nextmv.cli.cloud.managed_input.list import app as list_app
11
+ from nextmv.cli.cloud.managed_input.update import app as update_app
12
+
13
+ # Set up subcommand application.
14
+ app = typer.Typer()
15
+ app.add_typer(create_app)
16
+ app.add_typer(delete_app)
17
+ app.add_typer(get_app)
18
+ app.add_typer(list_app)
19
+ app.add_typer(update_app)
20
+
21
+
22
+ @app.callback()
23
+ def callback() -> None:
24
+ """
25
+ Create and handle managed inputs for Nextmv Cloud applications.
26
+
27
+ A managed input is a stored input that can be referenced and used across
28
+ runs and experiments. Managed inputs help organize and reuse test cases
29
+ and datasets within your application.
30
+ """
31
+ pass
@@ -0,0 +1,144 @@
1
+ """
2
+ This module defines the cloud managed-input 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 enum_values, error, in_progress, print_json
11
+ from nextmv.cli.options import AppIDOption, ProfileOption
12
+ from nextmv.input import InputFormat
13
+ from nextmv.run import Format, FormatInput
14
+
15
+ # Set up subcommand application.
16
+ app = typer.Typer()
17
+
18
+
19
+ @app.command()
20
+ def create(
21
+ app_id: AppIDOption,
22
+ content_format: Annotated[
23
+ InputFormat | None,
24
+ typer.Option(
25
+ "--content-format",
26
+ "-c",
27
+ help=f"The content format for the managed input. "
28
+ f"Allowed values are: {enum_values(InputFormat)}. Default is JSON.",
29
+ metavar="CONTENT_FORMAT",
30
+ ),
31
+ ] = None,
32
+ description: Annotated[
33
+ str | None,
34
+ typer.Option(
35
+ "--description",
36
+ "-d",
37
+ help="An optional description for the managed input.",
38
+ metavar="DESCRIPTION",
39
+ ),
40
+ ] = None,
41
+ managed_input_id: Annotated[
42
+ str | None,
43
+ typer.Option(
44
+ "--managed-input-id",
45
+ "-m",
46
+ help="The ID to assign to the new managed input. If not provided, a random ID will be generated.",
47
+ envvar="NEXTMV_MANAGED_INPUT_ID",
48
+ metavar="MANAGED_INPUT_ID",
49
+ ),
50
+ ] = None,
51
+ name: Annotated[
52
+ str | None,
53
+ typer.Option(
54
+ "--name",
55
+ "-n",
56
+ help="A name for the managed input. If not provided, the ID will be used as the name.",
57
+ metavar="NAME",
58
+ ),
59
+ ] = None,
60
+ run_id: Annotated[
61
+ str | None,
62
+ typer.Option(
63
+ "--run-id",
64
+ "-r",
65
+ help="ID of the run to use for the managed input. Either --upload-id or --run-id must be specified.",
66
+ envvar="NEXTMV_RUN_ID",
67
+ metavar="RUN_ID",
68
+ ),
69
+ ] = None,
70
+ upload_id: Annotated[
71
+ str | None,
72
+ typer.Option(
73
+ "--upload-id",
74
+ "-u",
75
+ help="ID of the upload to use for the managed input. Either --upload-id or --run-id must be specified.",
76
+ metavar="UPLOAD_ID",
77
+ ),
78
+ ] = None,
79
+ profile: ProfileOption = None,
80
+ ) -> None:
81
+ """
82
+ Create a new Nextmv Cloud application managed input.
83
+
84
+ A managed input can be created from either an upload or a run. Use the
85
+ --upload-id flag to create from an upload, or the --run-id flag to create
86
+ from a run output.
87
+
88
+ You can get an upload ID by using the [code]nextmv cloud upload
89
+ create[/code] command. The [magenta].upload_id[/magenta] field in the
90
+ command output contains the upload ID, and the
91
+ [magenta].upload_url[/magenta] field contains a pre-signed URL to upload
92
+ the data to. You may use the [code]nextmv cloud data upload[/code] command
93
+ to upload the data to the upload URL.
94
+
95
+ If no ID is provided, a unique ID will be automatically generated. If no
96
+ name is provided, the ID will be used as the name.
97
+
98
+ [bold][underline]Examples[/underline][/bold]
99
+
100
+ - Create a managed input from an upload.
101
+ $ [dim]nextmv cloud managed-input create --app-id hare-app --name "Test Input 1" \
102
+ --upload-id upl_123456789[/dim]
103
+
104
+ - Create a managed input from a run.
105
+ $ [dim]nextmv cloud managed-input create --app-id hare-app --name "Baseline Run" \
106
+ --run-id run_123456789[/dim]
107
+
108
+ - Create a managed input with a specific ID and description.
109
+ $ [dim]nextmv cloud managed-input create --app-id hare-app --name "Test Input" \\
110
+ --managed-input-id inp_custom --description "Test case for validation" --upload-id upl_123456789[/dim]
111
+
112
+ - Create a managed input with custom format.
113
+ $ [dim]nextmv cloud managed-input create --app-id hare-app --name "CSV Input" \\
114
+ --upload-id upl_123456789 --content-format csv[/dim]
115
+ """
116
+
117
+ if upload_id is None and run_id is None:
118
+ error(
119
+ "Either --upload-id or --run-id must be specified. "
120
+ "Use nextmv cloud upload create to create an upload first, "
121
+ "or specify an existing run ID."
122
+ )
123
+
124
+ cloud_app = build_app(app_id=app_id, profile=profile)
125
+
126
+ # Build format if content_format is provided
127
+ format_obj = None
128
+ if content_format is not None:
129
+ format_obj = Format(
130
+ format_input=FormatInput(
131
+ input_type=InputFormat(content_format),
132
+ ),
133
+ )
134
+
135
+ in_progress(msg="Creating managed input...")
136
+ managed_input = cloud_app.new_managed_input(
137
+ id=managed_input_id,
138
+ name=name,
139
+ description=description,
140
+ upload_id=upload_id,
141
+ run_id=run_id,
142
+ format=format_obj,
143
+ )
144
+ print_json(managed_input.to_dict())
@@ -0,0 +1,64 @@
1
+ """
2
+ This module defines the cloud managed-input 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, ManagedInputIDOption, ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def delete(
20
+ app_id: AppIDOption,
21
+ managed_input_id: ManagedInputIDOption,
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 managed input.
34
+
35
+ This action is permanent and cannot be undone. Use the --yes
36
+ flag to skip the confirmation prompt.
37
+
38
+ [bold][underline]Examples[/underline][/bold]
39
+
40
+ - Delete the managed input with the ID [magenta]inp_123456789[/magenta] from application
41
+ [magenta]hare-app[/magenta].
42
+ $ [dim]nextmv cloud managed-input delete --app-id hare-app \
43
+ --managed-input-id inp_123456789[/dim]
44
+
45
+ - Delete the managed input without confirmation prompt.
46
+ $ [dim]nextmv cloud managed-input delete --app-id hare-app --managed-input-id inp_123456789 --yes[/dim]
47
+ """
48
+
49
+ if not yes:
50
+ confirm = get_confirmation(
51
+ f"Are you sure you want to delete managed input [magenta]{managed_input_id}[/magenta] "
52
+ f"from application [magenta]{app_id}[/magenta]? This action cannot be undone.",
53
+ )
54
+
55
+ if not confirm:
56
+ info(f"Managed input [magenta]{managed_input_id}[/magenta] will not be deleted.")
57
+ return
58
+
59
+ cloud_app = build_app(app_id=app_id, profile=profile)
60
+ cloud_app.delete_managed_input(managed_input_id=managed_input_id)
61
+ success(
62
+ f"Managed input [magenta]{managed_input_id}[/magenta] deleted successfully "
63
+ f"from application [magenta]{app_id}[/magenta]."
64
+ )
@@ -0,0 +1,63 @@
1
+ """
2
+ This module defines the cloud managed-input 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, ManagedInputIDOption, ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def get(
20
+ app_id: AppIDOption,
21
+ managed_input_id: ManagedInputIDOption,
22
+ output: Annotated[
23
+ str | None,
24
+ typer.Option(
25
+ "--output",
26
+ "-o",
27
+ help="Saves the managed input information to this location.",
28
+ metavar="OUTPUT_PATH",
29
+ ),
30
+ ] = None,
31
+ profile: ProfileOption = None,
32
+ ) -> None:
33
+ """
34
+ Get a Nextmv Cloud application managed input.
35
+
36
+ This command is useful to get the attributes of an existing Nextmv Cloud
37
+ application managed input by its ID.
38
+
39
+ [bold][underline]Examples[/underline][/bold]
40
+
41
+ - Get the managed input with the ID [magenta]inp_123456789[/magenta] from application [magenta]hare-app[/magenta].
42
+ $ [dim]nextmv cloud managed-input get --app-id hare-app --managed-input-id inp_123456789[/dim]
43
+
44
+ - Get the managed input with the ID [magenta]inp_123456789[/magenta] and save the information to a
45
+ [magenta]managed_input.json[/magenta] file.
46
+ $ [dim]nextmv cloud managed-input get --app-id hare-app --managed-input-id inp_123456789 \
47
+ --output managed_input.json[/dim]
48
+ """
49
+
50
+ cloud_app = build_app(app_id=app_id, profile=profile)
51
+ in_progress(msg="Getting managed input...")
52
+ managed_input = cloud_app.managed_input(managed_input_id=managed_input_id)
53
+ managed_input_dict = managed_input.to_dict()
54
+
55
+ if output is not None and output != "":
56
+ with open(output, "w") as f:
57
+ json.dump(managed_input_dict, f, indent=2)
58
+
59
+ success(msg=f"Managed input information saved to [magenta]{output}[/magenta].")
60
+
61
+ return
62
+
63
+ print_json(managed_input_dict)
@@ -0,0 +1,60 @@
1
+ """
2
+ This module defines the cloud managed-input 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 managed input list information to this location.",
27
+ metavar="OUTPUT_PATH",
28
+ ),
29
+ ] = None,
30
+ profile: ProfileOption = None,
31
+ ) -> None:
32
+ """
33
+ List all managed inputs of a Nextmv Cloud application.
34
+
35
+ [bold][underline]Examples[/underline][/bold]
36
+
37
+ - List all managed inputs of application [magenta]hare-app[/magenta].
38
+ $ [dim]nextmv cloud managed-input list --app-id hare-app[/dim]
39
+
40
+ - List all managed inputs using the profile named [magenta]hare[/magenta].
41
+ $ [dim]nextmv cloud managed-input list --app-id hare-app --profile hare[/dim]
42
+
43
+ - List all managed inputs and save the information to a [magenta]managed_inputs.json[/magenta] file.
44
+ $ [dim]nextmv cloud managed-input list --app-id hare-app --output managed_inputs.json[/dim]
45
+ """
46
+
47
+ cloud_app = build_app(app_id=app_id, profile=profile)
48
+ in_progress(msg="Listing managed inputs...")
49
+ managed_inputs = cloud_app.list_managed_inputs()
50
+ managed_inputs_dicts = [managed_input.to_dict() for managed_input in managed_inputs]
51
+
52
+ if output is not None and output != "":
53
+ with open(output, "w") as f:
54
+ json.dump(managed_inputs_dicts, f, indent=2)
55
+
56
+ success(msg=f"Managed input list information saved to [magenta]{output}[/magenta].")
57
+
58
+ return
59
+
60
+ print_json(managed_inputs_dicts)
@@ -0,0 +1,97 @@
1
+ """
2
+ This module defines the cloud managed-input 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, ManagedInputIDOption, ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def update(
20
+ app_id: AppIDOption,
21
+ managed_input_id: ManagedInputIDOption,
22
+ description: Annotated[
23
+ str | None,
24
+ typer.Option(
25
+ "--description",
26
+ "-d",
27
+ help="A new description for the managed input.",
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 managed input.",
37
+ metavar="NAME",
38
+ ),
39
+ ] = None,
40
+ output: Annotated[
41
+ str | None,
42
+ typer.Option(
43
+ "--output",
44
+ "-o",
45
+ help="Saves the updated managed input information to this location.",
46
+ metavar="OUTPUT_PATH",
47
+ ),
48
+ ] = None,
49
+ profile: ProfileOption = None,
50
+ ) -> None:
51
+ """
52
+ Updates a Nextmv Cloud application managed input.
53
+
54
+ [bold][underline]Examples[/underline][/bold]
55
+
56
+ - Update a managed input's name.
57
+ $ [dim]nextmv cloud managed-input update --app-id hare-app \
58
+ --managed-input-id inp_123456789 --name "Updated Test Input"[/dim]
59
+
60
+ - Update a managed input's description.
61
+ $ [dim]nextmv cloud managed-input update --app-id hare-app --managed-input-id inp_123456789 \\
62
+ --description "Updated test case for validation"[/dim]
63
+
64
+ - Update a managed input's name and description at once.
65
+ $ [dim]nextmv cloud managed-input update --app-id hare-app --managed-input-id inp_123456789 \\
66
+ --name "Updated Test Input" --description "Updated test case for validation"[/dim]
67
+
68
+ - Update a managed input and save the updated information to a [magenta]updated_managed_input.json[/magenta] file.
69
+ $ [dim]nextmv cloud managed-input update --app-id hare-app --managed-input-id inp_123456789 \\
70
+ --name "Updated Test Input" --output updated_managed_input.json[/dim]
71
+ """
72
+
73
+ if name is None and description is None:
74
+ error("Provide at least one option to update: --name or --description.")
75
+
76
+ cloud_app = build_app(app_id=app_id, profile=profile)
77
+
78
+ updated_managed_input = cloud_app.update_managed_input(
79
+ managed_input_id=managed_input_id,
80
+ name=name,
81
+ description=description,
82
+ )
83
+ success(
84
+ f"Managed input [magenta]{managed_input_id}[/magenta] updated successfully "
85
+ f"in application [magenta]{app_id}[/magenta]."
86
+ )
87
+ updated_managed_input_dict = updated_managed_input.to_dict()
88
+
89
+ if output is not None and output != "":
90
+ with open(output, "w") as f:
91
+ json.dump(updated_managed_input_dict, f, indent=2)
92
+
93
+ success(msg=f"Updated managed input information saved to [magenta]{output}[/magenta].")
94
+
95
+ return
96
+
97
+ print_json(updated_managed_input_dict)