nextmv 1.0.0.dev9__py3-none-any.whl → 1.1.0.dev0__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 (59) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/cli/CONTRIBUTING.md +31 -11
  3. nextmv/cli/cloud/__init__.py +2 -0
  4. nextmv/cli/cloud/acceptance/delete.py +1 -4
  5. nextmv/cli/cloud/account/__init__.py +5 -3
  6. nextmv/cli/cloud/account/create.py +4 -1
  7. nextmv/cli/cloud/account/delete.py +1 -1
  8. nextmv/cli/cloud/app/delete.py +1 -1
  9. nextmv/cli/cloud/app/push.py +23 -42
  10. nextmv/cli/cloud/batch/delete.py +1 -4
  11. nextmv/cli/cloud/ensemble/delete.py +1 -4
  12. nextmv/cli/cloud/input_set/__init__.py +2 -0
  13. nextmv/cli/cloud/input_set/delete.py +64 -0
  14. nextmv/cli/cloud/instance/delete.py +1 -1
  15. nextmv/cli/cloud/managed_input/delete.py +1 -1
  16. nextmv/cli/cloud/run/create.py +4 -9
  17. nextmv/cli/cloud/scenario/delete.py +1 -4
  18. nextmv/cli/cloud/secrets/delete.py +1 -4
  19. nextmv/cli/cloud/shadow/delete.py +1 -4
  20. nextmv/cli/cloud/shadow/stop.py +14 -2
  21. nextmv/cli/cloud/sso/__init__.py +32 -0
  22. nextmv/cli/cloud/sso/create.py +97 -0
  23. nextmv/cli/cloud/sso/delete.py +58 -0
  24. nextmv/cli/cloud/sso/disable.py +56 -0
  25. nextmv/cli/cloud/sso/enable.py +56 -0
  26. nextmv/cli/cloud/sso/get.py +61 -0
  27. nextmv/cli/cloud/sso/update.py +78 -0
  28. nextmv/cli/cloud/switchback/delete.py +1 -4
  29. nextmv/cli/cloud/switchback/stop.py +14 -2
  30. nextmv/cli/cloud/version/delete.py +1 -1
  31. nextmv/cli/community/__init__.py +1 -1
  32. nextmv/cli/community/clone.py +11 -198
  33. nextmv/cli/community/list.py +51 -116
  34. nextmv/cli/configuration/config.py +27 -0
  35. nextmv/cli/configuration/create.py +4 -4
  36. nextmv/cli/configuration/delete.py +1 -1
  37. nextmv/cli/main.py +2 -3
  38. nextmv/cli/message.py +71 -54
  39. nextmv/cloud/__init__.py +5 -0
  40. nextmv/cloud/account.py +12 -10
  41. nextmv/cloud/application/__init__.py +12 -204
  42. nextmv/cloud/application/_acceptance.py +13 -8
  43. nextmv/cloud/application/_input_set.py +42 -6
  44. nextmv/cloud/application/_run.py +2 -2
  45. nextmv/cloud/application/_shadow.py +9 -3
  46. nextmv/cloud/application/_switchback.py +11 -2
  47. nextmv/cloud/batch_experiment.py +3 -1
  48. nextmv/cloud/community.py +446 -0
  49. nextmv/cloud/integration.py +7 -4
  50. nextmv/cloud/shadow.py +25 -0
  51. nextmv/cloud/sso.py +248 -0
  52. nextmv/cloud/switchback.py +2 -0
  53. nextmv/model.py +40 -4
  54. nextmv/options.py +1 -1
  55. {nextmv-1.0.0.dev9.dist-info → nextmv-1.1.0.dev0.dist-info}/METADATA +3 -1
  56. {nextmv-1.0.0.dev9.dist-info → nextmv-1.1.0.dev0.dist-info}/RECORD +59 -49
  57. {nextmv-1.0.0.dev9.dist-info → nextmv-1.1.0.dev0.dist-info}/WHEEL +0 -0
  58. {nextmv-1.0.0.dev9.dist-info → nextmv-1.1.0.dev0.dist-info}/entry_points.txt +0 -0
  59. {nextmv-1.0.0.dev9.dist-info → nextmv-1.1.0.dev0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,97 @@
1
+ """
2
+ This module defines the cloud sso create command for the Nextmv CLI.
3
+ """
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+ from nextmv.cli.configuration.config import build_client
10
+ from nextmv.cli.message import in_progress, print_json
11
+ from nextmv.cli.options import ProfileOption
12
+ from nextmv.cloud.sso import SSOConfiguration
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def create(
20
+ allow_non_domain_users: Annotated[
21
+ bool,
22
+ typer.Option(
23
+ "--allow-non-domain-users",
24
+ "-a",
25
+ help="Allow users who are not part of the SSO domain to access the Nextmv Cloud organization (account).",
26
+ ),
27
+ ] = False,
28
+ enabled: Annotated[
29
+ bool,
30
+ typer.Option(
31
+ "--enabled",
32
+ "-e",
33
+ help="Enable SSO for the Nextmv Cloud organization (account) at the time of creation. "
34
+ "Run [code]nextmv cloud sso enable[/code] to enable SSO after creation.",
35
+ ),
36
+ ] = False,
37
+ metadata_url: Annotated[
38
+ str | None,
39
+ typer.Option(
40
+ "--metadata-url",
41
+ "-u",
42
+ help="The URL to the SSO metadata document.",
43
+ metavar="METADATA_URL",
44
+ ),
45
+ ] = None,
46
+ metadata_document: Annotated[
47
+ str | None,
48
+ typer.Option(
49
+ "--metadata-document",
50
+ "-d",
51
+ help="The SSO metadata document as a string.",
52
+ metavar="METADATA_DOCUMENT",
53
+ ),
54
+ ] = None,
55
+ profile: ProfileOption = None,
56
+ ) -> None:
57
+ """
58
+ Create a new SSO configuration for your Nextmv Cloud organization.
59
+
60
+ SSO must be configured to enable managed accounts in your organization.
61
+ Please contact [link=https://www.nextmv.io/contact][bold]Nextmv support[/bold][/link] for assistance.
62
+
63
+ You must provide either a metadata URL or a metadata document. The metadata
64
+ document contains the SAML configuration details from your identity provider.
65
+
66
+ [bold][underline]Examples[/underline][/bold]
67
+
68
+ - Create an SSO configuration using a metadata URL.
69
+ $ [dim]nextmv cloud sso create --metadata-url "https://sso.carrotexpress.com/saml/metadata"[/dim]
70
+
71
+ - Create and enable SSO configuration immediately.
72
+ $ [dim]nextmv cloud sso create --metadata-url "https://sso.bunnylogistics.io/metadata" \\
73
+ --enabled[/dim]
74
+
75
+ - Create SSO configuration allowing non-domain users.
76
+ $ [dim]nextmv cloud sso create --metadata-url "https://idp.hopmail.com/saml/metadata" \\
77
+ --allow-non-domain-users[/dim]
78
+
79
+ - Create SSO configuration using a metadata document string.
80
+ $ [dim]nextmv cloud sso create --metadata-document "<EntityDescriptor ...</EntityDescriptor>"[/dim]
81
+
82
+ - Create SSO configuration using the profile named [magenta]hare[/magenta].
83
+ $ [dim]nextmv cloud sso create --metadata-url "https://sso.cottontailcouriers.net/metadata" \\
84
+ --profile hare[/dim]
85
+ """
86
+
87
+ cloud_client = build_client(profile)
88
+ in_progress(msg="Creating configuration...")
89
+
90
+ configuration = SSOConfiguration.new(
91
+ client=cloud_client,
92
+ allow_non_domain_users=allow_non_domain_users,
93
+ enabled=enabled,
94
+ metadata_url=metadata_url,
95
+ metadata_document=metadata_document,
96
+ )
97
+ print_json(configuration.to_dict())
@@ -0,0 +1,58 @@
1
+ """
2
+ This module defines the cloud sso 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_sso_config
10
+ from nextmv.cli.confirm import get_confirmation
11
+ from nextmv.cli.message import info, success
12
+ from nextmv.cli.options import ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def delete(
20
+ yes: Annotated[
21
+ bool,
22
+ typer.Option(
23
+ "--yes",
24
+ "-y",
25
+ help="Agree to deletion confirmation prompt. Useful for non-interactive sessions.",
26
+ ),
27
+ ] = False,
28
+ profile: ProfileOption = None,
29
+ ) -> None:
30
+ """
31
+ Deletes the SSO configuration.
32
+
33
+ You must have the [magenta]administrator[/magenta] role on the organization in order to delete it.
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 SSO configuration.
41
+ $ [dim]nextmv cloud sso delete[/dim]
42
+
43
+ - Delete the SSO configuration without confirmation prompt.
44
+ $ [dim]nextmv cloud sso delete --yes[/dim]
45
+ """
46
+
47
+ if not yes:
48
+ confirm = get_confirmation(
49
+ "Are you sure you want to delete the sso configuration? This action cannot be undone.",
50
+ )
51
+
52
+ if not confirm:
53
+ info("SSO configuration will not be deleted.")
54
+ return
55
+
56
+ sso_config = build_sso_config(profile)
57
+ sso_config.delete()
58
+ success("SSO configuration has been deleted.")
@@ -0,0 +1,56 @@
1
+ """
2
+ This module defines the cloud sso disable 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_sso_config
10
+ from nextmv.cli.confirm import get_confirmation
11
+ from nextmv.cli.message import info, success
12
+ from nextmv.cli.options import ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def disable(
20
+ yes: Annotated[
21
+ bool,
22
+ typer.Option(
23
+ "--yes",
24
+ "-y",
25
+ help="Agree to disable confirmation prompt. Useful for non-interactive sessions.",
26
+ ),
27
+ ] = False,
28
+ profile: ProfileOption = None,
29
+ ) -> None:
30
+ """
31
+ Disables the SSO configuration.
32
+
33
+ Use the --yes flag to skip the confirmation prompt. Use the [code]nextmv
34
+ cloud sso enable[/code] command to re-enable SSO.
35
+
36
+ [bold][underline]Examples[/underline][/bold]
37
+
38
+ - Disable the SSO configuration.
39
+ $ [dim]nextmv cloud sso disable[/dim]
40
+
41
+ - Disable the SSO configuration without confirmation prompt.
42
+ $ [dim]nextmv cloud sso disable --yes[/dim]
43
+ """
44
+
45
+ if not yes:
46
+ confirm = get_confirmation(
47
+ "Are you sure you want to disable the sso configuration?.",
48
+ )
49
+
50
+ if not confirm:
51
+ info("SSO configuration will not be disabled.")
52
+ return
53
+
54
+ sso_config = build_sso_config(profile)
55
+ sso_config.disable()
56
+ success("SSO configuration has been disabled.")
@@ -0,0 +1,56 @@
1
+ """
2
+ This module defines the cloud sso enable 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_sso_config
10
+ from nextmv.cli.confirm import get_confirmation
11
+ from nextmv.cli.message import info, success
12
+ from nextmv.cli.options import ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def enable(
20
+ yes: Annotated[
21
+ bool,
22
+ typer.Option(
23
+ "--yes",
24
+ "-y",
25
+ help="Agree to enable confirmation prompt. Useful for non-interactive sessions.",
26
+ ),
27
+ ] = False,
28
+ profile: ProfileOption = None,
29
+ ) -> None:
30
+ """
31
+ Enables the SSO configuration.
32
+
33
+ Use the --yes flag to skip the confirmation prompt. Use the [code]nextmv
34
+ cloud sso disable[/code] command to disable SSO.
35
+
36
+ [bold][underline]Examples[/underline][/bold]
37
+
38
+ - Enable the SSO configuration.
39
+ $ [dim]nextmv cloud sso enable[/dim]
40
+
41
+ - Enable the SSO configuration without confirmation prompt.
42
+ $ [dim]nextmv cloud sso enable --yes[/dim]
43
+ """
44
+
45
+ if not yes:
46
+ confirm = get_confirmation(
47
+ "Are you sure you want to enable the sso configuration?.",
48
+ )
49
+
50
+ if not confirm:
51
+ info("SSO configuration will not be enabled.")
52
+ return
53
+
54
+ sso_config = build_sso_config(profile)
55
+ sso_config.enable()
56
+ success("SSO configuration has been enabled.")
@@ -0,0 +1,61 @@
1
+ """
2
+ This module defines the cloud sso get command for the Nextmv CLI.
3
+ """
4
+
5
+ import json
6
+ from typing import Annotated
7
+
8
+ import typer
9
+
10
+ from nextmv.cli.configuration.config import build_client
11
+ from nextmv.cli.message import in_progress, print_json, success
12
+ from nextmv.cli.options import ProfileOption
13
+ from nextmv.cloud.sso import SSOConfiguration
14
+
15
+ # Set up subcommand application.
16
+ app = typer.Typer()
17
+
18
+
19
+ @app.command()
20
+ def get(
21
+ output: Annotated[
22
+ str | None,
23
+ typer.Option(
24
+ "--output",
25
+ "-o",
26
+ help="Saves the SSO configuration information to this location.",
27
+ metavar="OUTPUT_PATH",
28
+ ),
29
+ ] = None,
30
+ profile: ProfileOption = None,
31
+ ) -> None:
32
+ """
33
+ Get the information of a Nextmv Cloud SSO configuration.
34
+
35
+ This command is useful to get the attributes of an existing Nextmv Cloud
36
+ SSO configuration.
37
+
38
+ [bold][underline]Examples[/underline][/bold]
39
+
40
+ - Get the SSO configuration.
41
+ $ [dim]nextmv cloud sso get[/dim]
42
+
43
+ - Get the SSO configuration and save the information to an [magenta]sso_config.json[/magenta] file.
44
+ $ [dim]nextmv cloud sso get --output sso_config.json[/dim]
45
+ """
46
+
47
+ client = build_client(profile)
48
+ in_progress(msg="Getting SSO configuration...")
49
+
50
+ sso_config = SSOConfiguration.get(client)
51
+ sso_config_dict = sso_config.to_dict()
52
+
53
+ if output is not None and output != "":
54
+ with open(output, "w") as f:
55
+ json.dump(sso_config_dict, f, indent=2)
56
+
57
+ success(msg=f"SSO configuration information saved to [magenta]{output}[/magenta].")
58
+
59
+ return
60
+
61
+ print_json(sso_config_dict)
@@ -0,0 +1,78 @@
1
+ """
2
+ This module defines the cloud sso 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_sso_config
11
+ from nextmv.cli.message import print_json, success
12
+ from nextmv.cli.options import ProfileOption
13
+
14
+ # Set up subcommand application.
15
+ app = typer.Typer()
16
+
17
+
18
+ @app.command()
19
+ def update(
20
+ metadata_url: Annotated[
21
+ str | None,
22
+ typer.Option(
23
+ "--metadata-url",
24
+ "-u",
25
+ help="The URL to the SSO metadata document to update.",
26
+ metavar="METADATA_URL",
27
+ ),
28
+ ] = None,
29
+ metadata_document: Annotated[
30
+ str | None,
31
+ typer.Option(
32
+ "--metadata-document",
33
+ "-d",
34
+ help="The SSO metadata document as a string to update.",
35
+ metavar="METADATA_DOCUMENT",
36
+ ),
37
+ ] = None,
38
+ output: Annotated[
39
+ str | None,
40
+ typer.Option(
41
+ "--output",
42
+ "-o",
43
+ help="Saves the updated SSO configuration information to this location.",
44
+ metavar="OUTPUT_PATH",
45
+ ),
46
+ ] = None,
47
+ profile: ProfileOption = None,
48
+ ) -> None:
49
+ """
50
+ Updates information of a Nextmv Cloud SSO configuration.
51
+
52
+ This command allows you to update the metadata URL or metadata document of
53
+ an existing SSO configuration.
54
+
55
+ [bold][underline]Examples[/underline][/bold]
56
+
57
+ - Update the SSO configuration with a new metadata URL.
58
+ $ [dim]nextmv cloud sso update --metadata-url "https://example.com/metadata.xml"[/dim]
59
+
60
+ - Update the SSO configuration with a new metadata document and save the updated information to an
61
+ [magenta]updated_sso_config.json[/magenta] file.
62
+ $ [dim]nextmv cloud sso update --metadata-document "<xml>...</xml>" --output updated_sso_config.json[/dim]
63
+ """
64
+
65
+ sso_config = build_sso_config(profile)
66
+ updated_config = sso_config.update(metadata_url=metadata_url, metadata_document=metadata_document)
67
+ success("SSO configuration updated successfully.")
68
+ updated_config_dict = updated_config.to_dict()
69
+
70
+ if output is not None and output != "":
71
+ with open(output, "w") as f:
72
+ json.dump(updated_config_dict, f, indent=2)
73
+
74
+ success(msg=f"Updated SSO configuration information saved to [magenta]{output}[/magenta].")
75
+
76
+ return
77
+
78
+ print_json(updated_config_dict)
@@ -53,10 +53,7 @@ def delete(
53
53
  )
54
54
 
55
55
  if not confirm:
56
- info(
57
- msg=f"Switchback test [magenta]{switchback_test_id}[/magenta] will not be deleted.",
58
- emoji=":bulb:",
59
- )
56
+ info(f"Switchback test [magenta]{switchback_test_id}[/magenta] will not be deleted.")
60
57
  return
61
58
 
62
59
  cloud_app = build_app(app_id=app_id, profile=profile)
@@ -2,11 +2,14 @@
2
2
  This module defines the cloud switchback stop command for the Nextmv CLI.
3
3
  """
4
4
 
5
+ from typing import Annotated
6
+
5
7
  import typer
6
8
 
7
9
  from nextmv.cli.configuration.config import build_app
8
- from nextmv.cli.message import in_progress, success
10
+ from nextmv.cli.message import enum_values, in_progress, success
9
11
  from nextmv.cli.options import AppIDOption, ProfileOption, SwitchbackTestIDOption
12
+ from nextmv.cloud.shadow import StopIntent
10
13
 
11
14
  # Set up subcommand application.
12
15
  app = typer.Typer()
@@ -15,6 +18,15 @@ app = typer.Typer()
15
18
  @app.command()
16
19
  def stop(
17
20
  app_id: AppIDOption,
21
+ intent: Annotated[
22
+ StopIntent,
23
+ typer.Option(
24
+ "--intent",
25
+ "-i",
26
+ help=f"Intent for stopping the switchback test. Allowed values are: {enum_values(StopIntent)}.",
27
+ metavar="INTENT",
28
+ ),
29
+ ],
18
30
  switchback_test_id: SwitchbackTestIDOption,
19
31
  profile: ProfileOption = None,
20
32
  ) -> None:
@@ -34,7 +46,7 @@ def stop(
34
46
 
35
47
  in_progress(msg="Stopping switchback test...")
36
48
  cloud_app = build_app(app_id=app_id, profile=profile)
37
- cloud_app.stop_switchback_test(switchback_test_id=switchback_test_id)
49
+ cloud_app.stop_switchback_test(switchback_test_id=switchback_test_id, intent=StopIntent(intent))
38
50
  success(
39
51
  f"Switchback test [magenta]{switchback_test_id}[/magenta] stopped successfully "
40
52
  f"in application [magenta]{app_id}[/magenta]."
@@ -51,7 +51,7 @@ def delete(
51
51
  )
52
52
 
53
53
  if not confirm:
54
- info(msg=f"Version [magenta]{version_id}[/magenta] will not be deleted.", emoji=":bulb:")
54
+ info(f"Version [magenta]{version_id}[/magenta] will not be deleted.")
55
55
  return
56
56
 
57
57
  cloud_app = build_app(app_id=app_id, profile=profile)
@@ -9,8 +9,8 @@ from nextmv.cli.community.list import app as list_app
9
9
 
10
10
  # Set up subcommand application.
11
11
  app = typer.Typer()
12
- app.add_typer(list_app)
13
12
  app.add_typer(clone_app)
13
+ app.add_typer(list_app)
14
14
 
15
15
 
16
16
  @app.callback()